os.isfile() error
Gary Wessle
phddas at yahoo.com
Sat May 6 17:41:21 EDT 2006
Hi
could someone help me to find out whats wrong with this code?
**************** code ****************
import os, sys
if len(sys.argv) < 2:
sys.exit("please enter a suitable directory.")
dpath = sys.argv[1]
for name in os.listdir(dpath):
if os.isfile(dpath+name):
infile = open(os.path.join(dpath,name), 'rb')
print type(infile)
**************** error ****************
Traceback (most recent call last):
File "python/useful/cat2all.py", line 13, in ?
if os.isfile(dpath+name):
AttributeError: 'module' object has no attribute 'isfile'
thank you
More information about the Python-list
mailing list