Pierre wrote:
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
^^^^^^^
Here's the bug. You're using Windows. It's a filesystem, but not as we know it...
Anyway, You are getting exactly what the low-level Windows APIs return.
Here's a small "C" program. It prints "0" next to the filename if the
file exists, -1 otherwise, as described at
http://msdn.microsoft.com/library/de..._._waccess.asp
int main(int argc, char **argv) {
int i;
for(i=1; i<argc; i++) {
printf("%20s: %d\n", argv[i], _access(argv[i], 0));
}
}
I compiled it with "i386-mingw32msvc-gcc -o a.exe exist.c"
Here's an example session with it:
C:\TMP\example> dir
Volume in drive C has no label.
Volume Serial Number is 171D-4D2A
Directory of C:\TMP\example
07/06/05 03:04p <DIR> .
07/06/05 03:04p <DIR> ..
07/06/05 03:05p 3 exist
3 File(s) 3 bytes
C:\TMP\example> x:a.exe exist exist. exist.... nonexist nonexist. nonexist...
exist: 0
exist.: 0
exist....: 0
nonexist: -1
nonexist.: -1
nonexist...: -1
C:\TMP\example> type nonexist....
The system cannot find the file specified.
C:\TMP\example> type exist....
C:\TMP\example>
As you can see, not only does Windows think that "exist...." exists, but itcan
successfully "type" its contents too!
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQFCzDn4Jd0 1MZaTXX0RAuCEAJ 9fcQp7EL7uXEnCn DD3iBkpFih5/gCfQ9Jd
uglZQylJ9n2ChXM UinFaACk=
=jFuL
-----END PGP SIGNATURE-----