Newbie simple py2exe problem

Michael Urban urba0083 at tc.umn.edu
Sat Jan 11 15:05:21 EST 2003


Bubba wrote:

 > This is my setup.py
 > # setup.py
 >    from distutils.core import setup
 >    import py2exe
 >
 >    setup(name="counter",
 >          scripts=["counter.py"],
 >    )


And therein lies your syntax error. "from distutils.core import setup" 
cannot be indented since Python uses indentation for delimiting code 
blocks. "from" is part of the main block. Indenting it is causing the 
syntax error. That's why the carrot in the traceback is pointing to the 
first letter of "from" as well.

You also need to remove the indentation from all of the other statements 
because they are all part of the main code block. My fortune telling for 
you is that if you only remove it from the one starting with "from", the 
next error you will get is:

C:\Python22>python setup.py py2exe
   File "setup.py", line 4
     import py2exe
     ^
SyntaxError: invalid syntax

Remove the intendations and you should be fine.





More information about the Python-list mailing list