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
|
# win9x, ./logs
|
||||||
LOGPATH = 'Logs'
|
LOGPATH = 'Logs'
|
||||||
|
|
||||||
LOGPATH = LOGPATH.decode(sys.getfilesystemencoding())
|
try:
|
||||||
|
LOGPATH = LOGPATH.decode(sys.getfilesystemencoding())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
class Logger:
|
class Logger:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -86,8 +86,11 @@ class OptionsParser:
|
||||||
|
|
||||||
def write(self):
|
def write(self):
|
||||||
(base_dir, filename) = os.path.split(self.__filename)
|
(base_dir, filename) = os.path.split(self.__filename)
|
||||||
base_dir = base_dir.decode(sys.getfilesystemencoding())
|
try:
|
||||||
filename = filename.decode(sys.getfilesystemencoding())
|
base_dir = base_dir.decode(sys.getfilesystemencoding())
|
||||||
|
filename = filename.decode(sys.getfilesystemencoding())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
self.__tempfile = os.path.join(base_dir, '.' + filename)
|
self.__tempfile = os.path.join(base_dir, '.' + filename)
|
||||||
try:
|
try:
|
||||||
fd = open(self.__tempfile, 'w')
|
fd = open(self.__tempfile, 'w')
|
||||||
|
|
|
@ -989,7 +989,10 @@ class PreferencesWindow:
|
||||||
if response != gtk.RESPONSE_OK:
|
if response != gtk.RESPONSE_OK:
|
||||||
break
|
break
|
||||||
file = dialog.get_filename()
|
file = dialog.get_filename()
|
||||||
file = file.decode(sys.getfilesystemencoding())
|
try:
|
||||||
|
file = file.decode(sys.getfilesystemencoding())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if os.path.exists(file):
|
if os.path.exists(file):
|
||||||
break
|
break
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
|
@ -2116,7 +2119,10 @@ class ManageEmoticonsWindow:
|
||||||
response = dialog.run()
|
response = dialog.run()
|
||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
file = dialog.get_filename()
|
file = dialog.get_filename()
|
||||||
file = file.decode(sys.getfilesystemencoding())
|
try:
|
||||||
|
file = file.decode(sys.getfilesystemencoding())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if self.image_is_ok(file):
|
if self.image_is_ok(file):
|
||||||
ok = True
|
ok = True
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -166,7 +166,10 @@ class VcardWindow:
|
||||||
response = dialog.run()
|
response = dialog.run()
|
||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
f = dialog.get_filename()
|
f = dialog.get_filename()
|
||||||
f = f.decode(sys.getfilesystemencoding())
|
try:
|
||||||
|
f = f.decode(sys.getfilesystemencoding())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if self.image_is_ok(f):
|
if self.image_is_ok(f):
|
||||||
ok = True
|
ok = True
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue