[New-bugs-announce] [issue13807] logging.Handler.handlerError() may raise AttributeError in traceback.print_exception()

Thomas Ryschawy report at bugs.python.org
Tue Jan 17 17:00:14 CET 2012


New submission from Thomas Ryschawy <ThomasOtto.Ryschawy at Emerson.com>:

It seems to be known that in case of a Windows GUI app that isn’t connected to a console sys.stderr can be None. See the Note on http://docs.python.org/py3k/library/sys.html: Under some conditions stdin, stdout and stderr as well as the original values __stdin__, __stdout__ and __stderr__ can be None. It is usually the case for Windows GUI apps that aren’t connected to a console and Python apps started with pythonw.
In combination with logging this leads to an issue similar to issue #5971. In my case sys.stderr is None and File: lib\logging\__init__.py, Class: Handler, Method: handleError raises AttributeError: 'NoneType' object has no attribute 'write'.
A 'simple' solution would be to check if sys.stderr is not None. In case it is None handleError must not call traceback.print_exception() and not directly write to sys.stderr.

----------
components: Library (Lib)
files: traceback.txt
messages: 151462
nosy: ThomasRyschawy
priority: normal
severity: normal
status: open
title: logging.Handler.handlerError() may raise AttributeError in traceback.print_exception()
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file24263/traceback.txt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13807>
_______________________________________


More information about the New-bugs-announce mailing list