This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author stockbsd
Recipients stockbsd
Date 2014-12-09.01:27:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
in py3k, the following simple code will throw an uncatched exception when executed with pythonw:

import warnings

the problem occurs in showarning function: in py3k's pythonw , stderr/stdout is set to None, so the file.write(...) statement will thorw AttributeError uncatched. I think a catch-all except(delete 'OSError') can solve this.

def showwarning(message, category, filename, lineno, file=None, line=None):
    """Hook to write a warning to a file; replace if you like."""
    if file is None:
        file = sys.stderr
        file.write(formatwarning(message, category, filename, lineno, line))
    except OSError:
        pass # the file (probably stderr) is invalid - this warning gets lost.
Date User Action Args
2014-12-09 01:27:03stockbsdsetrecipients: + stockbsd
2014-12-09 01:27:03stockbsdsetmessageid: <>
2014-12-09 01:27:03stockbsdlinkissue23016 messages
2014-12-09 01:27:02stockbsdcreate