UnicodeEncodeError in compile
tjreedy at udel.edu
Tue Jan 10 22:50:51 EST 2012
On 1/10/2012 3:08 AM, Terry Reedy wrote:
> On 1/9/2012 11:24 PM, pyscripter at gmail.com wrote:
>> Using python 3.2 in Windows 7 I am getting the following:
>>>> compile('pass', r'c:\temp\工具\module1.py', 'exec')
Is this a filename that could be an actual, valid filename on your system?
>> UnicodeEncodeError: 'mbcs' codec can't encode characters in position
>> 0--1: invalid character
>> Can anybody explain why the compile statement tries to convert the
>> unicode filename using mbcs?
Good question. I believe this holdover from 2.x should be deleted.
I argued that in http://bugs.python.org/issue10114
(which was about a different problem) and now, directly, in
If you (or anyone) can make a better argument for the requested change,
or for also changing compile on *nix, than I did, please do so.
Terry Jan Reedy
More information about the Python-list