Author Tianjg
Recipients Tianjg, eryksun, ezio.melotti, paul.moore, steve.dower, tianjg, tim.golden, vstinner, zach.ware
Date 2017-12-20.09:53:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CABmY+6yuaxFgf=k1W-RME3VTU1+k0nrsZH5PsuT0cmzb_+YFug@mail.gmail.com>
In-reply-to <1513755355.67.0.213398074469.issue32381@psf.upfronthosting.co.za>
Content
Thanks a lot. What should I do to  reopen .pyc file with non-ASCII path use
python3.6 in cmd?Could you give me* some **code examples*.Thank you again,
and I look forward to hearing from you

2017-12-20 15:35 GMT+08:00 Eryk Sun <report@bugs.python.org>:

>
> Eryk Sun <eryksun@gmail.com> added the comment:
>
> run_file encodes the file path via PyUnicode_EncodeFSDefault, which
> encodes as UTF-8 in Windows, starting with 3.6. PyRun_SimpleFileExFlags
> subsequently tries to open this encoded path via _Py_fopen, which calls
> fopen. The CRT expects an ANSI encoded path, so only the common ASCII
> subset will work. Non-ASCII paths will fail.
>
> This could be addressed in _Py_fopen by decoding the path and calling
> _wfopen instead of fopen.
>
> Executing a .pyc also fails in 3.5 if the wide-character path can't be
> encoded as ANSI, but the 3.5 branch only accepts security fixes.
>
> ----------
> components: +Interpreter Core, Unicode
> nosy: +eryksun, ezio.melotti, vstinner
> stage:  -> test needed
> title: python3.6 can not reopen .pyc file with Chinese path -> Python 3.6
> cannot reopen .pyc file with non-ASCII path
> type: compile error -> behavior
> versions: +Python 3.7
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue32381>
> _______________________________________
>
History
Date User Action Args
2017-12-20 09:53:43Tianjgsetrecipients: + Tianjg, paul.moore, vstinner, tim.golden, ezio.melotti, zach.ware, eryksun, steve.dower, tianjg
2017-12-20 09:53:43Tianjglinkissue32381 messages
2017-12-20 09:53:43Tianjgcreate