Note that there are some explanatory texts on larger screens.

plurals
  1. POpy2exe executable doesn't use sys.argv[x]
    text
    copied!<p>I've written a very simple code in python and generated one .exe with py2exe.</p> <p>I've added the imports to see if there's a problem with importing those modules.</p> <pre><code>import sys import time, os, httplib2 from csv import writer, reader, DictWriter from BeautifulSoup import BeautifulSoup def main(): print sys.argv[1] if __name__ == '__main__': main() </code></pre> <p>when I run it as a .py file it works great.</p> <blockquote> <p>C:\Users\User>C:\Python27\Lib\site-packages\py2exe\samples\sysargv\module3.py justChecking justChecking</p> </blockquote> <p>but when I run the executable py2exe had generated it does nothing - </p> <blockquote> <p>C:\Users\User>C:\Python27\Lib\site-packages\py2exe\samples\sysargv\dist\module3.exe JustCheking</p> </blockquote> <p>that's the code of the setup.py</p> <pre><code>from distutils.core import setup import py2exe setup( options = {'py2exe': {'bundle_files': 1}}, windows = [{'script': "module3.py"}], zipfile = None, ) </code></pre> <p>I need to use sys.argv in my program (I'm getting input from the user, things like output directory, log file path etc')</p> <p>how do I use sys.argv when using py2exe to create one executable?</p> <p>another question, if I have python 2.7 32 bit installed on a win7 64 bit computer (I've installed the <a href="http://www.python.org/getit/" rel="nofollow">regular win' 2.7.2 msi file from python.org</a>) and generated a single executable on that computer, will I be able to use the .exe on win7\xp 32 bit?</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload