[issue10210] os.get_exec_path() should not produce any warning
STINNER Victor
report at bugs.python.org
Wed Oct 27 02:58:06 CEST 2010
New submission from STINNER Victor <victor.stinner at haypocalc.com>:
Using -b command line option, os.get_exec_path() always produce a warning. Example:
$ ./python -b
>>> import os: os.get_exec_path({'PATH': ''})
.../Lib/os.py:395: BytesWarning: Comparison between bytes and string
path_listb = env[b'PATH']
['']
You can see such warning on some buildbots. This function should make this warning quiet because it is expected: it is not possible to check that a dict contains 'PATH' and b'PATH' keys without emiting a BytesWarning (see issue #9636).
Attached patch fixes this bug. It imports the warnings module in get_exec_path() function because os is a core module and it should not import too much modules. But... I'm not sure that it's the right way to fix this issue.
----------
components: Library (Lib), Unicode
files: get_exec_path_byteswarning.patch
keywords: patch
messages: 119666
nosy: haypo
priority: normal
severity: normal
status: open
title: os.get_exec_path() should not produce any warning
versions: Python 3.2
Added file: http://bugs.python.org/file19378/get_exec_path_byteswarning.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10210>
_______________________________________
More information about the Python-bugs-list
mailing list