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 vstinner
Recipients vstinner
Date 2010-10-02.12:14:19
SpamBayes Score 1.6265615e-07
Marked as misclassified No
Message-id <1286021663.34.0.689026258035.issue10014@psf.upfronthosting.co.za>
In-reply-to
Content
In the following example, sys.path[0] should be '/home/SHARE/SVN/py3k\udcc3\udca9' (my locale and filesystem encodings are utf-8):

$ cd /home/SHARE/SVN/py3ké
$ echo "import sys; print(sys.path[0])" > x.py
$ ./python x.py
/home/SHARE/SVN/py3ké
$ PYTHONFSENCODING=ascii ./python x.py
/home/SHARE/SVN/py3ké

The problem is that PySys_SetArgvEx() inserts argv[0] at sys.path[0], but argv[0] is decoded using the locale encoding (by _Py_char2wchar() in main()), whereas paths of sys.path are supposed to be encodable (and decoded) by sys.getfilesystemencoding().

argv array should be decoded using the filesystem encoding (see issue #9992) or argv[0] should be redecoded (encode to the locale encoding, and decode from the filesystem encoding, see issue #9630).
History
Date User Action Args
2010-10-02 12:14:23vstinnersetrecipients: + vstinner
2010-10-02 12:14:23vstinnersetmessageid: <1286021663.34.0.689026258035.issue10014@psf.upfronthosting.co.za>
2010-10-02 12:14:21vstinnerlinkissue10014 messages
2010-10-02 12:14:19vstinnercreate