when IOError occurs during saving preferences
now print os.strerror of the error code
This commit is contained in:
parent
07fecda486
commit
cdf6e034b8
2 changed files with 9 additions and 15 deletions
|
@ -79,14 +79,8 @@ class OptionsParser:
|
|||
try:
|
||||
gajim.config.foreach(self.write_line, fd)
|
||||
except IOError, e:
|
||||
print e, dir(e), e.errno
|
||||
if e.errno == 28:
|
||||
err_str = _('No space left on device')
|
||||
else:
|
||||
err_str = e
|
||||
print err_str
|
||||
fd.close()
|
||||
return err_str
|
||||
return e.errno
|
||||
fd.close()
|
||||
if os.path.exists(self.__filename):
|
||||
# win32 needs this
|
||||
|
@ -96,8 +90,7 @@ class OptionsParser:
|
|||
pass
|
||||
try:
|
||||
os.rename(self.__tempfile, self.__filename)
|
||||
except:
|
||||
err_str = _('Unable to open %s for writing\n') % (self.__filename)
|
||||
return err_str
|
||||
except IOError, e:
|
||||
return e.errno
|
||||
return None
|
||||
|
||||
|
|
11
src/gajim.py
11
src/gajim.py
|
@ -1020,11 +1020,12 @@ class Interface:
|
|||
return False
|
||||
|
||||
def save_config(self):
|
||||
err_str = parser.write()
|
||||
if err_str is not None:
|
||||
dialogs.ErrorDialog(_('Cannot save your preferences'),
|
||||
err_str).get_response()
|
||||
sys.exit(2)
|
||||
err_code = parser.write()
|
||||
if err_code is not None:
|
||||
os.strerror(err_code)
|
||||
# it is good to notify the user, in case he cannot see the output of the console
|
||||
dialogs.ErrorDialog(_('Cannot save your preferences')).get_response()
|
||||
sys.exit(1)
|
||||
|
||||
def enable_dbus(self):
|
||||
if 'remote_control' not in globals():
|
||||
|
|
Loading…
Add table
Reference in a new issue