sys.getfilesystemencoding() can return None to some systems (eg. OpenBSD). Thanks Jolan for patches

This commit is contained in:
Nikos Kouremenos 2005-10-21 13:21:31 +00:00
parent cb1be7a818
commit 8a1326a810
4 changed files with 21 additions and 6 deletions

View File

@ -36,7 +36,10 @@ if os.name == 'nt':
# win9x, ./logs
LOGPATH = 'Logs'
LOGPATH = LOGPATH.decode(sys.getfilesystemencoding())
try:
LOGPATH = LOGPATH.decode(sys.getfilesystemencoding())
except:
pass
class Logger:
def __init__(self):

View File

@ -86,8 +86,11 @@ class OptionsParser:
def write(self):
(base_dir, filename) = os.path.split(self.__filename)
base_dir = base_dir.decode(sys.getfilesystemencoding())
filename = filename.decode(sys.getfilesystemencoding())
try:
base_dir = base_dir.decode(sys.getfilesystemencoding())
filename = filename.decode(sys.getfilesystemencoding())
except:
pass
self.__tempfile = os.path.join(base_dir, '.' + filename)
try:
fd = open(self.__tempfile, 'w')

View File

@ -989,7 +989,10 @@ class PreferencesWindow:
if response != gtk.RESPONSE_OK:
break
file = dialog.get_filename()
file = file.decode(sys.getfilesystemencoding())
try:
file = file.decode(sys.getfilesystemencoding())
except:
pass
if os.path.exists(file):
break
dialog.destroy()
@ -2116,7 +2119,10 @@ class ManageEmoticonsWindow:
response = dialog.run()
if response == gtk.RESPONSE_OK:
file = dialog.get_filename()
file = file.decode(sys.getfilesystemencoding())
try:
file = file.decode(sys.getfilesystemencoding())
except:
pass
if self.image_is_ok(file):
ok = True
else:

View File

@ -166,7 +166,10 @@ class VcardWindow:
response = dialog.run()
if response == gtk.RESPONSE_OK:
f = dialog.get_filename()
f = f.decode(sys.getfilesystemencoding())
try:
f = f.decode(sys.getfilesystemencoding())
except:
pass
if self.image_is_ok(f):
ok = True
else: