sys.getfilesystemencoding() can return None to some systems (eg. OpenBSD). Thanks Jolan for patches
This commit is contained in:
parent
cb1be7a818
commit
8a1326a810
|
@ -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):
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue