473,398 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Odd behaviour of os module with a Win2k shared directory

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 os.chdir(pth)
os.getcwd() '\\\\nom\\dietplan6' os.path.exists(os.getcwd()) False


--
Regards,
David Hughes

Jul 18 '05 #1
2 1438
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" <df*@forestfield.co.uk> wrote in message
news:me***********************@forestfield.cix.co. uk...
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 os.chdir(pth)
os.getcwd() '\\\\nom\\dietplan6' os.path.exists(os.getcwd()) False


--
Regards,
David Hughes

Jul 18 '05 #2
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" <lb****@swamisoft.com> wrote in message
news:qu********************@comcast.com...
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" <df*@forestfield.co.uk> wrote in message
news:me***********************@forestfield.cix.co. uk...
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
>> os.chdir(pth)
>> os.getcwd()

'\\\\nom\\dietplan6'
>> os.path.exists(os.getcwd())

False
>>


--
Regards,
David Hughes


Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: John J. Lee | last post by:
I'm tearing my hair out at what seems like weird import behaviour I'm getting from Python's stdlib test script, regrtest.py (not for the first time: seem to have forgotten the resolution from last...
6
by: Kay Schluehr | last post by:
The documentation of the Python console behaviour is not correct anymore for Python 2.4.1. At least for the Win2K system I'm working on 'Ctrl-Z' does not shut down the console but 'Ctrl-D' etc. ...
0
by: Envex Developments | last post by:
Hey guys, I have a need to install the DBD::Pg Perl module on many shared web servers, which do not have PostgreSQL installed. Then the DBD::Pg module will just connect to a remote PostgreSQL...
0
by: Envex Developments | last post by:
Hey guys, I have a need to install the DBD::Pg Perl module on many shared web servers, which do not have PostgreSQL installed. Then the DBD::Pg module will just connect to a remote PostgreSQL...
10
by: p175 | last post by:
Hi folks, I'm after some guidelines on general memory allocations for DB2 8.2.2 ESE on Win2k Server FP4 with 4gb physical memory. Seeing as everything is 32bit and win2k server does not...
6
by: alanknipmeyer | last post by:
Hi, I`m in the process of migrating a Access 2002 (Run in 2000 mode) from Windows 98 to Win2K Server. It is a shared resource via a file share on the 98 Server. Client systems are Win98 with the...
4
by: | last post by:
I have earlier used an HttpModule that did URL rewrites on the BeginRequest event. Now I am trying to use the same module in a different application on a new and upgraded machine (winxp sp2). ...
12
by: Steven Bethard | last post by:
Ok, so I have a module that is basically a Python wrapper around a big lookup table stored in a text file. The module needs to provide a few functions:: get_stem(word, pos, default=None)...
1
by: aznach | last post by:
Hello! I have a shared hosting account at GrokThis.net and have a problem with the module order of the Python search path. I'd like to use django's svn trunk instead of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.