[New-bugs-announce] [issue9713] Py_CompileString fails on non decode-able paths.

Campbell Barton report at bugs.python.org
Mon Aug 30 09:46:53 CEST 2010

New submission from Campbell Barton <ideasman42 at gmail.com>:

On linux I have a path which python reads as...


os.listdir("/data/test/") returns this ['num\udce9ro_bad']

But the same path cant be given to the C api's Py_CompileString

Where fn is '/data/test/num\udce9ro_bad/untitled.blend/test.py'
 Py_CompileString(buf, fn, Py_file_input);

...gives this error.
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 14-16: invalid data

>From this pep, non decode-able paths should use surrogateescape's

components: None
messages: 115202
nosy: ideasman42
priority: normal
severity: normal
status: open
title: Py_CompileString fails on non decode-able paths.
type: behavior
versions: Python 3.1

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list