question about os.path.isdir

BearFx bearfx at hotmail.com
Mon Mar 17 16:03:50 EST 2003


I am new to python, and am working on a small script to manipulate
some files.  My files are stored on a network directory, mapped as u:
.  This is a netware server, with a unc(for example) of
\\nw-server\data\sec\users\user1

I used os.listdir("u:\\:) to get a list of files, then iteratered
through them as below.  The problem is os.path.isfile(base + fn) fails
every time.  .isdir works OK.  I have tried using both the mapped
drive, and the unc path.

import os
base = "u:\\"
basefilelist = os.listdir(base)
for filename in basefilelist:
        if (os.path.isdir(base + filename)):
              print "Dir " + filename      #this works
        elif (os.path.isfile(base + filename)):
              print "File " + filename     #no matter the file i never
get here
        else:
              print "Unknown " + filename     #all files print here

With a little more testing, I foung that every test fails for the
file, even os.path.exists .  However, if I set base to a local
directory, it works normally.

Any assistance with this problem would be appreciated.  I am running
Windows XP sp 1 with Novell Netware Client 4.83 and Python 2.2




More information about the Python-list mailing list