Victor Hartemam
Victor Hartemam

Reputation: 31

cx_Freeze error: no commands supplied

I'm trying to create a executable from my .py file.

I did this:

import cx_Freeze

executables = [cx_Freeze.Executable("Cobra.py")]

cx_Freeze.setup(name="Snake Python", options={"build_exe":{"packages":["pygame","time","sys","os","random"]}}, executables = executables)

And run from Python GUI. It returns the follow erros:

Traceback (most recent call last):
  File "C:/Users/victor/Desktop/tcc/Jogo_Cobra/setup.py", line 5, in <module>
    cx_Freeze.setup(name="Snake Python", options={"build_exe":{"packages":["pygame","time","sys","os","random"]}}, executables = executables)
  File "C:\Python32\lib\site-packages\cx_Freeze\dist.py", line 365, in setup
    distutils.core.setup(**attrs)
  File "C:\Python32\lib\distutils\core.py", line 137, in setup
    raise SystemExit(gen_usage(dist.script_name) + "\nerror: %s" % msg)
SystemExit: 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 supplies

I using Python 3.2 on windows 8.1 and cx_Freeze-4.3.2.win32-py3.2

thanks for any help!

Upvotes: 3

Views: 4411

Answers (2)

Kade
Kade

Reputation: 1012

If you do not want to supply a command via command line, you can have your script do it for you.

Place this in your code before cx_Freeze.setup, and you can run it without adding parameters yourself:

import sys
sys.argv.append("build")

This would be the same as running your file like this:

python setup.py build

Upvotes: 3

Suever
Suever

Reputation: 65430

You need to actually pass a command to setup.py to tell it to build the executable

python setup.py build

This command will create a subdirectory called build with a further subdirectory starting with the letters exe. and ending with the typical identifier for the platform that distutils uses

Alternately you can have it build the executable and wrap it in an installer for easy distribution

python setup.py bdist_msi

Upvotes: 0

Related Questions