Problem with os.path

Daya Kiran Sunkara dayakiran at gmail.com
Fri Dec 16 00:15:37 EST 2005


Hi All,

I have a program which fetches the list of files inside a directory.
For fetching this list I am making use of the glob.glob method which
takes path as a parameter.
For building the path I am making use of os.path.join. My code looks
somewhat like this:
-----------------------------------------------------------------------
import glob
import os
path = 'E:\mktrisk\service\marketdata\da'
for filename in glob.glob(os.path.join(path,'*.java')):
    datafile = open(filename,'r').readlines()
----------------------------------------------------------------------

this program works fine when the string 'path' is not too long. When I
pass a longer string as path, the program doesn't work. Now I am not
sure whether its a limitation with the string class or with os.path. I
am passing a valid path to the program and I am running this on Python
2.4.2 on Windows XP.

Any help will be greatly appreciated.

regards,
Daya



More information about the Python-list mailing list