On Thu, 19 Aug 2010 19:10:19 +0200 (CEST) victor.stinner <python-check...@python.org> wrote: > Author: victor.stinner > Date: Thu Aug 19 19:10:18 2010 > New Revision: 84204 > > Log: > Fix os.get_exec_path() (code and tests) for python -bb > > Catch BytesWarning exceptions.
You should not catch warnings, but silence them using constructs provided by the warnings module: with warnings.catch_warnings(): warnings.simplefilter(ignore, BytesWarning) # the rest of your code Otherwise you'll get buggy behaviour where e.g. env[b'PATH'] raises BytesWarning because of an unicode key, but it would have succeeded otherwise. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com