File io error Python
- by serpiente
I have a program that monitors a folder with word documents for any modifications made on the files. The error -Windows Error[2] The system cannot find the file specified- comes when I run the program, open a .doc within the folder make some changes and save it. Any suggestions on how to fix this?
Here's the code:
def archivar():
txt = open('archivo.txt', 'r+' )
for rootdir, dirs, files in os.walk(r"C:\Users\keinsfield\Desktop\colegio"):
for file in files:
time = os.stat(os.path.join(rootdir, file)).st_ctime
txt.write(file +','+str(time) + '\n')
def check():
txt = [col.split(',') for col in (open('archivo.txt', 'r+').read().split('\n'))]
files = os.listdir(r"C:\Users\keinsfield\Desktop\colegio")
for file in files:
for info in txt:
if info[0]==os.stat(os.path.join(r"C:\Users\keinsfield\Desktop\colegio",file)).st_ctime:
print "modified"