Reputation: 81
I'm trying to convert my Python programs with the Py2exe library with the following setup.py code below:
from distutils.core import setup
import py2exe
file = raw_input("Python file to convert:")
setup(console=[file])
Then, when I enter in the program I want to convert, it says:
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
And then it stops. Do any of you know what could be causing this?
Upvotes: 4
Views: 5211
Reputation: 44
I got the same error as the original poster. I couldn't get py2exe working, even on a toy hello world-style script. However: This worked for me: PyInstaller, more instructions here: How to make a Python script standalone executable to run without ANY dependency?
If it expects arguments, it should take them like this: put this inside the python script:
import sys
thisArg = sys.argv[1]
make sure you call it in command prompt with the arguments:
my_script "argument1"
Note, no .py at the end.
argv[0] is self, the script name itself.
Upvotes: 0