0

I am trying to make a script executable with py2exe.

Here is my setup.py code:

import cx_Freeze

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

cx_Freeze.setup(
    name="Email",
    options={"build_exe": {"packages":["pygame"],
                           "include_files":["aura.png"]}},
    executables = executables

    )

And I run this from my cmd and here is the execution:

G:\Grade 12 Project>python setup.py build running build running build_exe creating directory build\exe.win32-2.7 copying C:\Python27\lib\site-packages\cx_Freeze\bases\Console.exe -> build\exe.win32-2.7\Email.exe copying C:\WINDOWS\SYSTEM32\python27.dll
-> build\exe.win32-2.7\python27.dll Traceback (most recent call last):   File "setup.py", line 9, in <module>
    executables = executables   File "C:\Python27\lib\site-packages\cx_Freeze\dist.py", line 349, in setup
    distutils.core.setup(**attrs)   File "C:\Python27\lib\distutils\core.py", line 151, in setup
    dist.run_commands()   File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)   File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()   File "C:\Python27\lib\distutils\command\build.py", line 127, in run
    self.run_command(cmd_name)   File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)   File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()   File "C:\Python27\lib\site-packages\cx_Freeze\dist.py", line 219, in run
    freezer.Freeze()   File "C:\Python27\lib\site-packages\cx_Freeze\freezer.py", line 623, in Freeze
    self._FreezeExecutable(executable)   File "C:\Python27\lib\site-packages\cx_Freeze\freezer.py", line 225, in
_FreezeExecutable
    self._AddVersionResource(exe)   File "C:\Python27\lib\site-packages\cx_Freeze\freezer.py", line 165, in
_AddVersionResource
    trademarks = exe.trademarks)   File "C:\Python27\lib\site-packages\cx_Freeze\freezer.py", line 759, in
__init__
    parts = version.split(".") AttributeError: 'NoneType' object has no attribute 'split'

Also in my build folder , when I run Email.exe, I get this error:

ImportError: No module named __startup__
amin
  • 1,413
  • 14
  • 24
White Shadow
  • 444
  • 2
  • 10
  • 26

1 Answers1

2

As @Mohammad Yusuf Ghazi said, you need to pass a version='x.y.z' parameter into the setup call, e.g:

cx_Freeze.setup(
    name="Email",
    options={
        "build_exe": {"packages":["pygame"],
        "include_files":["aura.png"]}},
    executables = executables,
    version='1.0.0'
)

It's not valid to call setup without a version number.

Are you trying to run this from the command line or from the GUI? If from the GUI you may need to call Executable("Email.py", base="Win32GUI") as per the docs in order for it to work, so that might be the problem. But it would help to see the full traceback.

daphtdazz
  • 7,754
  • 34
  • 54