title: Python exception:"TypeError: main() got an unexpected keyword argument 'debug'" but IFF the module is run via scheduledTask on Windows XP SP2
body: <p>Running Python 2.5 on Windows XP SP2.</p>
  
  <p>When I run a Python script that calls a user-defined module called <code>Zipper.py</code> (basically a wrapper for a zipfile) using a Windows scheduledTask I get this exception:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):<br>
           File "C:\PythonScripts\ZipAndSendEOD-Reports.py", line 78, in main<br>
               Zipper.main([report],f, debug=True) #[:-4] + "_" + str(x) + ".zip")<br>
    TypeError: main() got an unexpected keyword argument 'debug'</p>
  </blockquote>
  
  <p>The odd thing is that if I simply open the file in <a href="http://en.wikipedia.org/wiki/IDLE_%28Python%29" rel="nofollow">IDLE</a> and hit 'F5', it runs flawlessly.</p>
  
  <p>I'm sure I left out some pertinent information, please let me know what you need.</p>
  
  <p><code>Zipper.py</code> looks like this:  </p>
  
  <pre><code>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()
  </code></pre>
  
  <p>EDIT:
  I added the following two lines of code to the calling function, and it now works. </p>
  
  <pre><code>f =  open(logFile, 'a')
  f.write(Zipper.__file__)
  </code></pre>
  
  <p>Can you explain THAT to me?</p>