Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18740
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: UnicodeEncodeError in compile |
| Date | 2012-01-10 03:08 -0500 |
| References | <9043309.329.1326169476466.JavaMail.geo-discussion-forums@yqhi24> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4584.1326182952.27778.python-list@python.org> (permalink) |
On 1/9/2012 11:24 PM, pyscripter@gmail.com wrote:
> Using python 3.2 in Windows 7 I am getting the following:
>
>>> compile('pass', r'c:\temp\工具\module1.py', 'exec')
> 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? I know that sys.getfilesystemencoding returns 'mbcs' in Windows, but I thought that this is not used when unicode file names are provided.
I get the same error running 3.2.2 under IDLE but not when pasting into
Command Prompt. However, Command Prompt may be cheating by replacing the
Chinese chars with '??' upon pasting, so that Python never gets them --
whereas they appear just fine in IDLE.
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
UnicodeEncodeError in compile pyscripter@gmail.com - 2012-01-09 20:24 -0800
Re: UnicodeEncodeError in compile Terry Reedy <tjreedy@udel.edu> - 2012-01-10 03:08 -0500
Re: UnicodeEncodeError in compile jmfauth <wxjmfauth@gmail.com> - 2012-01-10 01:42 -0800
Re: UnicodeEncodeError in compile 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-10 02:53 -0800
Re: UnicodeEncodeError in compile jmfauth <wxjmfauth@gmail.com> - 2012-01-10 04:28 -0800
Re: UnicodeEncodeError in compile jmfauth <wxjmfauth@gmail.com> - 2012-01-10 05:43 -0800
Re: UnicodeEncodeError in compile Terry Reedy <tjreedy@udel.edu> - 2012-01-10 19:56 -0500
Re: UnicodeEncodeError in compile jmfauth <wxjmfauth@gmail.com> - 2012-01-11 01:29 -0800
Re: UnicodeEncodeError in compile jmfauth <wxjmfauth@gmail.com> - 2012-01-10 23:05 -0800
Re: UnicodeEncodeError in compile 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-10 02:53 -0800
Re: UnicodeEncodeError in compile pyscripter@gmail.com - 2012-01-10 02:04 -0800
Re: UnicodeEncodeError in compile Terry Reedy <tjreedy@udel.edu> - 2012-01-10 22:50 -0500
Re: UnicodeEncodeError in compile pyscripter@gmail.com - 2012-01-11 03:27 -0800
Re: UnicodeEncodeError in compile Dave Angel <d@davea.name> - 2012-01-11 06:45 -0500
Re: UnicodeEncodeError in compile pyscripter@gmail.com - 2012-01-11 04:14 -0800
Re: UnicodeEncodeError in compile pyscripter@gmail.com - 2012-01-11 04:14 -0800
Re: UnicodeEncodeError in compile pyscripter@gmail.com - 2012-01-11 03:27 -0800
csiph-web