Odd behaviour of os module with a Win2k shared directory

D

David Hughes

I shared a directory, dietplan6, which is actually several levels down in
C:\Program files\ on a Windows 2000 machine, called 'Nom'. When I tried to
check its existence from another Win2k machine, I got the following
strange results:

Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.['unins000.dat', 'program', 'database', 'resource', 'doc', 'dlm',
'dp5conv', 'gs', 'Readme.txt', 'dietplan.lic', 'users', 'imports',
'unins000.exe', 'locks']
 
L

Larry Bates

When you access a share on Windows 2000 machine it acts
as if it is the root directory. That being said your
command checked to see if dietplan6 had a file/folder
inside of it named dietplan6. If you can see the share
then it exists. If you want to test for the existence
of the dietplan6, you would need to define your share
one level up in the tree. Think of it this way, you
can't test for the existence of the root directory.

HTH,
Larry Bates
Syscon, Inc.

David Hughes said:
I shared a directory, dietplan6, which is actually several levels down in
C:\Program files\ on a Windows 2000 machine, called 'Nom'. When I tried to
check its existence from another Win2k machine, I got the following
strange results:

Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.['unins000.dat', 'program', 'database', 'resource', 'doc', 'dlm',
'dp5conv', 'gs', 'Readme.txt', 'dietplan.lic', 'users', 'imports',
'unins000.exe', 'locks']
 
R

Roger Upole

I think this is actually due to the library removing a trailing backslash.
If you put 2 trailing backslashes on the path to a share, you get True back.
Roger

Larry Bates said:
When you access a share on Windows 2000 machine it acts
as if it is the root directory. That being said your
command checked to see if dietplan6 had a file/folder
inside of it named dietplan6. If you can see the share
then it exists. If you want to test for the existence
of the dietplan6, you would need to define your share
one level up in the tree. Think of it this way, you
can't test for the existence of the root directory.

HTH,
Larry Bates
Syscon, Inc.

David Hughes said:
I shared a directory, dietplan6, which is actually several levels down in
C:\Program files\ on a Windows 2000 machine, called 'Nom'. When I tried to
check its existence from another Win2k machine, I got the following
strange results:

Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
import os
pth = r'\\nom\dietplan6'
os.path.exists(pth) False
os.listdir(pth)
['unins000.dat', 'program', 'database', 'resource', 'doc', 'dlm',
'dp5conv', 'gs', 'Readme.txt', 'dietplan.lic', 'users', 'imports',
'unins000.exe', 'locks']
os.path.exists(os.path.join(pth, 'program')) True
False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top