[Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

Thomas Breuel tmbdev at gmail.com
Thu Apr 30 22:55:48 CEST 2009


>
> Not for me (I am using Python 2.6.2).
>
> >>> f = open(chr(255), 'w')
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> IOError: [Errno 22] invalid mode ('w') or filename: '\xff'
> >>>


You can get the same error on Linux:

$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f=open(chr(255),'w')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 22] invalid mode ('w') or filename: '\xff'
>>>

(Some file system drivers do not enforce valid utf8 yet, but I suspect they
will in the future.)

Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090430/052fa8e6/attachment.htm>


More information about the Python-Dev mailing list