python - py2exe and setting up setup.py to get its target from argv? -


i'm trying create executable .py file, , if things exactly py2exe tutorial says, works. put setup(console=["thingyidliketodo.py"]) in setup.py file, type python setup.py py2exe console, , works.

but. means whenever want make python file executable, have go open , edit setup.py. , i'd rather else:

from distutils.core import setup sys import argv import py2exe  setup(console=[argv[1]]) ##this setup(console=["mytargetfile.py"]) , work way 

and type in python setup.py mytargetfile.py py2exe. on account of being invalid command name 'mytargetfile.py'

i've tried changing order, making python setup.py py2exe mytargetfile.py , changing argv[1] argv[2]. exact same error message.

i mean, have functioning way make .py files .exe files, i'm annoyed seems ought such simple change is't working. missing here?

you're running trouble because setup using sys.argv. if change call setup(console = [sys.argv.pop(1)] believe stop stepping on distutils' toes , things should go smoothly.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -