os.path.exists(//server/share) returns false when it should return true...
Syver Enstad
syver-en+usenet at online.no
Tue Oct 15 15:00:27 EDT 2002
pierre.archambault at cognos.com (Pierre) writes:
> Has anyone come across problems on win2k with the os.path module?
>
> Problem description:
>
> Create a share with read/write permissions such as - //computer/share
> os.path.exists(//computer/share) should return "true".
> Instead it returns "false" no matter what permissions are set.
>
> The only work around I have found is to call it this way -
> os.path.exists(//computer/share/folder) returns "true".
>
> Is this a python problem or is it that the module doesn't work well
> with UNC paths?
It seems to be a problem with the M$ runtime library and its
implementation of the stat function (which if you look at the source for
os.path.exists, it calls os.stat).
A very ugly workaround would be to:
# creates a temporary mapping to the share, and sets the current
# directory to it
os.system('pushd \\\\server\\share')
os.path.exists('.')
# kill the mapping, and back to previous working directory
os.system('popd')
--
Vennlig hilsen
Syver Enstad
More information about the Python-list
mailing list