0

I'm attempting to convert a .py file to a .exe file. However, I get a weird output.

Output:

usage: module1 [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: module1 --help [cmd1 cmd2 ...]
   or: module1 --help-commands
   or: module1 cmd --help

error: no commands supplied

My code:

from distutils.core import setup
import py2exe

setup(console=['newstyledemo.py'])

Also when this is done where do I recover the .exe file? I'd like to place it on a flash drive for redistribution.

I'm running Python 2.6 on Windows-7, BTW

1
  • The .exe file ends up under dist directory. Also, could you try setup(console=[{'newstyledemo' : 'newstyledemo.py'}]) Commented Aug 20, 2010 at 7:10

1 Answer 1

1

Useing Gui2exe can be smart,i use it to both console and gui.

Here is a script i have used,and have worked ok.

from distutils.core import setup
import py2exe
import sys

if len(sys.argv) == 1:
    sys.argv.append("py2exe")

setup( options = {"py2exe": {"compressed": 1, "optimize": 2, "ascii": 1, "bundle_files": 3}},
       zipfile = None,

       ## data_files = ['apple.jpg', 'cheese.jpg'],

       #Your py-file can use windows or console
       windows = [{"script": 'my.py'}])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.