Extra Newby question - Trying to create md5 File Listing
James Johnston
jxjohns at lifeway.com
Wed Sep 27 10:50:16 EDT 2006
I've never written a Python program before and I'm trying to read a config
file with file path/names (eg. c:\\python24\\*.dll, ... *.exe) to create an
output file of filename + md5 values. I'm confused. I'm trying to learn
how to use Wing IDE and step through the Stack Data. It seems to be
working but on the
[INDENT]for fn in filelist:
data = file(fn,'rb').read() [/INDENT]
I get a
[INDENT]IOError: (2, 'No such file or directory', 'c')
Traceback (innermost last):
File "c:\Python examples\md5makr_test4.py", line 1, in ?
#!/usr/bin/python
File "c:\Python examples\md5makr_test4.py", line 20, in ?
data = file(fn,'rb').read()[/INDENT]
[B]Code:[/B]
#!/usr/bin/python
# Filename: md5makr_test4.py
import sys, os, os.path, glob, md5, ConfigParser
config = ConfigParser.ConfigParser()
config.read('md5makr.ini')
outputfilname = config.get('general', 'outputfile')
f = file(outputfilname,'wt')
fileconfig = config.get('general', 'inputfiles')
fl = file(fileconfig,'r')
fileData = fl.read()
for f1 in glob.glob(fileData):
filelist = f1
for fn in filelist:
data = file(fn,'rb').read()
hexstring = md5.md5(data).hexdigest()
f.write(fn + '\t' + hexstring + '/n')
f.close()
Any insight or help would be appreciated.
More information about the Python-list
mailing list