[Newbie Question] Matching directory content with variable
Marcus Klein
marcus1 at marcus1.de
Sat May 11 10:32:16 EDT 2002
Hi out there,
I am trying to match a directory content with a variable to avoid
overwriting an existing file and it does not work.
Maybe someone knows why ?
--8<--
for f in TOGET:
print "getting remote file ", f
fname = PATHTOFILE + f
lfiles = os.listdir(PATHTOFILE)
lfile = re.compile(f, re.M).match(lfiles, 1)
if lfile:
print "Warning: File exists locally"
exit(5)
-->8--
leads to
--8<--
Traceback (most recent call last):
File "py/getftp.py", line 33, in ?
lfile = re.compile(f, re.M).match(lfiles, 1)
TypeError: expected string or buffer
-->8--
thanx in advance,
marcus
--
sick nature ?
More information about the Python-list
mailing list