diff --git a/src/common/optparser.py b/src/common/optparser.py index f005d1fdb..0c791b700 100644 --- a/src/common/optparser.py +++ b/src/common/optparser.py @@ -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 diff --git a/src/gajim.py b/src/gajim.py index d723b9ba8..51bf1a9ae 100755 --- a/src/gajim.py +++ b/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():