Title: open() on directory raises IOError with unhelpful message
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, benjamin.peterson, gregory.p.smith, hagen
Priority: critical Keywords: needs review, patch

Created on 2008-08-27 14:26 by hagen, last changed 2008-09-01 14:14 by benjamin.peterson. This issue is now closed.

File name Uploaded Description Edit
dircheck.patch amaury.forgeotdarc, 2008-08-27 15:07
Messages (4)
msg72033 - (view) Author: Hagen F├╝rstenau (hagen) Date: 2008-08-27 14:26
When trying to open a directory (on Linux), Python 2.x complained with

>>> open("local")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 21] Is a directory

Python 3.0 however gives the rather unhelpful or even wrong

>>> open("local")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/MC/hagenf/local/lib/python3.0/", line 284, in __new__
    return open(*args, **kwargs)
  File "/home/MC/hagenf/local/lib/python3.0/", line 223, in open
IOError: [Errno 0] Error: 'local'
msg72034 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-08-27 15:07
There is a call to dircheck(), but not in the correct place.
The attached patch makes sure that the "Is a directory" message is not
msg72068 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008-08-28 06:48
looks good to me
msg72248 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-09-01 14:14
Fixed in r66097.
Date User Action Args
2008-09-01 14:14:01benjamin.petersonsetstatus: open -> closed
nosy: + benjamin.peterson
resolution: fixed
messages: + msg72248
2008-08-28 06:48:37gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg72068
2008-08-27 15:07:41amaury.forgeotdarcsetpriority: critical
keywords: + patch, needs review
messages: + msg72034
files: + dircheck.patch
nosy: + amaury.forgeotdarc
2008-08-27 14:26:01hagencreate