Running Python 2.5 on Windows XP SP2.
When I run a Python script that calls a user-defined module called Zipper.py
(basically a wrapper for a zipfile) using a Windows scheduledTask I get this exception:
Traceback (most recent call last):
File "C:\PythonScripts\ZipAndSendEOD-Reports.py", line 78, in main
Zipper.main([report],f, debug=True) #[:-4] + "_" + str(x) + ".zip")
TypeError: main() got an unexpected keyword argument 'debug'
The odd thing is that if I simply open the file in IDLE and hit 'F5', it runs flawlessly.
I'm sure I left out some pertinent information, please let me know what you need.
Zipper.py
looks like this:
import zipfile
def main(archive_list=[],zfilename='default.zip', debug=False):
if debug: print 'file to zip', zfilename
zout = zipfile.ZipFile(zfilename, "w", zipfile.ZIP_DEFLATED)
for fname in archive_list:
if debug: print "writing: ", fname
zout.write(fname)
zout.close()
if __name__ == '__main__':
main()
EDIT: I added the following two lines of code to the calling function, and it now works.
f = open(logFile, 'a')
f.write(Zipper.__file__)
Can you explain THAT to me?
As Paul said, you're probably running a different version of Zipper.py
- I would print out Zipper.__file__
and then if you need to debug, print out sys.path
to see why it's finding a different file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With