New submission from stockbsd Li: in py3k, the following simple code will throw an uncatched exception when executed with pythonw:
import warnings warnings.warn('test') 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 try: file.write(formatwarning(message, category, filename, lineno, line)) except OSError: pass # the file (probably stderr) is invalid - this warning gets lost. ---------- components: Library (Lib) messages: 232342 nosy: stockbsd priority: normal severity: normal status: open title: uncatched exception in lib/warnings.py when executed with pythonw type: crash versions: Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23016> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com