This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients amaury.forgeotdarc, benjamin.peterson, pitrou, vstinner
Date 2010-07-18.14:09:28
SpamBayes Score 0.00033895439
Marked as misclassified No
Message-id <1279462171.13.0.608517762148.issue9293@psf.upfronthosting.co.za>
In-reply-to
Content
Some of them currently raise IOError. Fortunately, UnsupportedOperation inherits from IOError, which means compatibility can be preserved.

Contrast:
>>> open("LICENSE").write("bar")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: not writable

With:
>>> open("LICENSE", "rb").write(b"")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
io.UnsupportedOperation: write

Or:
>>> io.StringIO().fileno()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
io.UnsupportedOperation: fileno

Or, unfortunately:

>>> open("LICENSE", "rb", buffering=0).write(b"")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: File not open for writing
History
Date User Action Args
2010-07-18 14:09:31pitrousetrecipients: + pitrou, amaury.forgeotdarc, vstinner, benjamin.peterson
2010-07-18 14:09:31pitrousetmessageid: <1279462171.13.0.608517762148.issue9293@psf.upfronthosting.co.za>
2010-07-18 14:09:28pitroulinkissue9293 messages
2010-07-18 14:09:28pitroucreate