[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Strange os.path.exists() behaviour
From:       Pierre Quentel <quentel.pierre () wanadoo ! fr>
Date:       2005-07-06 19:50:43
Message-ID: 42cc3613$0$22287$8fcfb975 () news ! wanadoo ! fr
[Download RAW message or body]

os.path.exists(path) returns True if "path" exists

But on Windows it also returns True for "path" followed by any number of 
dots :

Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import os
 >>> os.path.exists('Lib/os.py')
True                # expected
 >>> os.path.exists('Lib/os.py.')
True                # unexpected
 >>> os.path.exists('Lib/os.py.....')
True                # unexpected
 >>>

Is there a reason for this ? Is there a test that returns True only for 
the really existing path ?

Pierre
-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic