Misleading IOerror when opening a non-existent file for append?
Antoon Pardon
apardon at forel.vub.ac.be
Tue Nov 21 09:03:04 EST 2006
More information about the Python-list mailing list
Tue Nov 21 09:03:04 EST 2006
- Previous message (by thread): Misleading IOerror when opening a non-existent file for append?
- Next message (by thread): Misleading IOerror when opening a non-existent file for append?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2006-11-21, jkn <jkn_gg at nicorp.f9.co.uk> wrote: > Hi there > Thanks for the comments. I see that I actually confused myself a > bit with my posting. It's been a while and I mistook the use of '/' as > a platform-independent directory delimiter with the use of '\\'. > > I also thought that I was seeing something similar on Windows and > Linux. This may not be the case ;-o. > > So, to try again. It looks as it the attempt to open a non-existent > file (for instance, because the parent folder does not exist) gives an > odd error on Linux but not on Windows. > > On Windows: > >> >>> f = file(r'c:\does-not-exist\DoesNotExist.txt','a') >> >> Traceback (most recent call last): >> File "<pyshell#0>", line 1, in <module> >> f = file(r'c:\does-not-exist\DoesNotExist.txt','a') >> IOError: [Errno 2] No such file or directory: 'c:\\does-not-exist >> \\DoesNotExist.txt' >> >>> > > (replacing the '\' with '/' gives the same message, which is what I was > trying to convey) > > On Linux, you get the 'Bad mode' error. > > Strange?! Not on my box (Python 2.4.4c0): >>> open("nodir/nofile", "a") Traceback (most recent call last): File "<stdin>", line 1, in ? IOError: [Errno 2] No such file or directory: 'nodir/nofile' -- Antoon Pardon
- Previous message (by thread): Misleading IOerror when opening a non-existent file for append?
- Next message (by thread): Misleading IOerror when opening a non-existent file for append?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list