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.
Created on 2010年02月05日 21:28 by skrah, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg98909 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2010年02月05日 21:28 | |
I think that certain FileIO methods should raise IOError instead of
ValueError when a file operation is attempted with the wrong mode.
The methods of IOBase are documented to raise IOError in these situations.
>>> import io
>>> f = io.open("testfile", "w")
>>> f.read()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: not readable
>>>
>>> f = io.FileIO("testfile", "w")
>>> f.read()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: File not open for reading
|
|||
| msg113784 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月13日 15:19 | |
All of them should probably raise io.UnsupportedOperation instead (which inherits from both IOError and ValueError). |
|||
| msg115531 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年09月03日 22:55 | |
See #9293, where there's a patch. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:57 | admin | set | github: 52110 |
| 2010年09月03日 22:55:51 | pitrou | set | status: open -> closed resolution: duplicate superseder: Unsupported IO operations should raise UnsupportedOperation messages: + msg115531 |
| 2010年08月13日 15:19:28 | pitrou | set | messages: + msg113784 |
| 2010年08月02日 19:17:50 | georg.brandl | set | assignee: pitrou |
| 2010年02月05日 22:35:01 | pitrou | set | nosy:
+ amaury.forgeotdarc |
| 2010年02月05日 21:28:18 | skrah | create | |