New submission from Peter Landgren <peter.tal...@telia.com>: This is in Windows. I got an error message in Logging in my application Gramps. However, there is an error message generated by by this logging, so the original message is never output. The last line indicate a problem with bytes in certain positions. I was able to check it and it is the Swedish character "å".
The logging call is: ... except (IOError, OSError), msg: msg = unicode(str(msg), sys.getfilesystemencoding()) LOG.error(_("Could not make database directory: ") + msg) which results in: 3165: ERROR: clidbman.py: line 335: Kunde inte skapa databasmappen: [Error 3] Det går inte att hitta sökväge n: u'F:\\' Traceback (most recent call last): File "C:\Python26\lib\logging\__init__.py", line 769, in emit msg = self.format(record) File "C:\Python26\lib\logging\__init__.py", line 649, in format return fmt.format(record) File "C:\Python26\lib\logging\__init__.py", line 448, in format s = s + record.exc_text UnicodeDecodeError: 'utf8' codec can't decode bytes in position 608-610: invalid data 4893: ERROR: gramps.py: line 138: Unhandled exception Traceback (most recent call last): File "C:\Program Files (x86)\gramps\gui\grampsgui.py", line 353, in __startgramps "Error details: %s %s" % (repr(e), fn), exc_info=True) File "C:\Python26\lib\logging\__init__.py", line 1075, in error self._log(ERROR, msg, args, **kwargs) File "C:\Python26\lib\logging\__init__.py", line 1166, in _log self.handle(record) File "C:\Python26\lib\logging\__init__.py", line 1176, in handle self.callHandlers(record) File "C:\Python26\lib\logging\__init__.py", line 1213, in callHandlers hdlr.handle(record) File "C:\Python26\lib\logging\__init__.py", line 674, in handle self.emit(record) File "C:\Program Files (x86)\gramps\GrampsLogger\_GtkHandler.py", line 26, in emit ErrorView(error_detail=self,rotate_handler=self._rotate_handler) File "C:\Program Files (x86)\gramps\GrampsLogger\_ErrorView.py", line 39, in __init__ self.draw_window() File "C:\Program Files (x86)\gramps\GrampsLogger\_ErrorView.py", line 94, in draw_window tb_label.get_buffer().set_text(self._error_detail.get_formatted_log()) File "C:\Program Files (x86)\gramps\GrampsLogger\_GtkHandler.py", line 29, in get_formatted_log return self.format(self._record) File "C:\Python26\lib\logging\__init__.py", line 649, in format return fmt.format(record) File "C:\Python26\lib\logging\__init__.py", line 448, in format s = s + record.exc_text UnicodeDecodeError: 'utf8' codec can't decode bytes in position 608-610: invalid data If I change line 448 in "C:\Python26\lib\logging\__init__.py" to: s = s + unicode(str(record.exc_text), sys.getfilesystemencoding()) I get the correct message: 4523: ERROR: grampsgui.py: line 353: Gramps terminated because of OS Error Error details: WindowsError(3, 'Det g\xe5r inte att hitta s\xf6kv\xe4gen') F:\grdbtest\*.* Traceback (most recent call last): File "C:\Program Files (x86)\gramps\gui\grampsgui.py", line 337, in __startgramps Gramps(argparser) File "C:\Program Files (x86)\gramps\gui\grampsgui.py", line 268, in __init__ gui=True) File "C:\Program Files (x86)\gramps\cli\arghandler.py", line 81, in __init__ self.dbman = CLIDbManager(self.dbstate) File "C:\Program Files (x86)\gramps\cli\clidbman.py", line 100, in __init__ self._populate_cli() File "C:\Program Files (x86)\gramps\cli\clidbman.py", line 175, in _populate_cli for dpath in os.listdir(dbdir): WindowsError: [Error 3] Det går inte att hitta sökvägen: u'F:\\grdbtest\\*.*' (There is a secondary problem with rendering some characers. All strings were generated on a Windows system, but I report using a Linux system.) ---------- components: Library (Lib) messages: 107208 nosy: PeterL priority: normal severity: normal status: open title: Error in error message in logging type: behavior versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8924> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com