when IOError occurs during saving preferences

now print os.strerror of the error code
This commit is contained in:
Dimitur Kirov 2005-08-09 11:17:32 +00:00
parent 07fecda486
commit cdf6e034b8
2 changed files with 9 additions and 15 deletions

View file

@ -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

View file

@ -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():