[New-bugs-announce] [issue25867] os.stat raises exception when using unicode and no locale is set

Ondrej Sejvl report at bugs.python.org
Tue Dec 15 03:33:11 EST 2015


New submission from Ondrej Sejvl:

os.stat() raises exception UnicodeEncodeError when path is unicode and no locale is set in envinronment (this occures when running app with daemon tools -> LC_ALL=)

How to simulate:
$ env -i python
>>> import os
>>> os.stat(u"\xf0")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf0' in position 0: ordinal not in range(128)

Is this a valid behaviour? Then maybe some notification in documentation would be nice (I am using os.path.isfile and now UnicodeEncodeError raised...)

Thanks
Ondra

----------
messages: 256446
nosy: sejvlond
priority: normal
severity: normal
status: open
title: os.stat raises exception when using unicode and no locale is set

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25867>
_______________________________________


More information about the New-bugs-announce mailing list