python - Script not working since windows 7 -
i have following script worked fine on xp, since have new pc on windows 7 professional code has stopped working
import os import shutil time import strftime logsdir="c:\logs" zipdir="c:\logs\puttylogs\zipped_logs" zip_program="zip.exe" files in os.listdir(logsdir): if files.endswith(".log"): files1=files+"."+strftime("%y-%m-%d")+".zip" os.chdir(logsdir) os.system(zip_program + " " + files1 +" "+ files) shutil.move(files1, zipdir) os.remove(files)
the error getting u:>python logs.py zip warning: name not matched: ping_dms_155.log
zip error: nothing do! (ping_dms_155.log.2013-05-14.zip) traceback (most recent call last): file "logs.py", line 24, in <module> shutil.move(files1, zipdir) file "c:\python27\lib\shutil.py", line 301, in move copy2(src, real_dst) file "c:\python27\lib\shutil.py", line 130, in copy2 copyfile(src, dst) file "c:\python27\lib\shutil.py", line 82, in copyfile open(src, 'rb') fsrc: ioerror: [errno 2] no such file or directory: 'ping_dms_155.log.2013-05-14.zip'
i can't think why stop working, in advance
it seems have zip.exe
on windows 7 machine error, may not version compatible windows 7.
check in logsdir
see if file modify (ping_dms_155.log.2013-05-14.zip
) exists. if of these true suggest using python module zipfile
.
Comments
Post a Comment