You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: