2

I am trying to create proper program with python which can be executable on a friend's computer. To do this I am using cx_Freeze and following the steps outlined here How can I convert a .py to .exe for Python 3.6?

However when I type python setup.py build in the prompt it gives me the following error. I have googled this but am not sure how to go about fixing it. Thank you for any help in advance.

 PS C:\Users\jhgwa> python setup.py build
running build
running build_exe
creating directory build\exe.win-amd64-3.6
copying C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\bases\Console.exe -> build\exe.win-amd64-3.6\Announcement Keyword From Headline Puller.exe
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-stdio-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-stdio-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\python36.dll -> build\exe.win-amd64-3.6\python36.dll
copying C:\Users\jhgwa\Anaconda3\VCRUNTIME140.dll -> build\exe.win-amd64-3.6\VCRUNTIME140.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-math-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-math-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-locale-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-locale-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-string-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-string-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-runtime-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-runtime-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-convert-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-convert-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-time-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-time-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-environment-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-environment-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-process-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-process-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-heap-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-heap-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-conio-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-conio-l1-1-0.dll
copying C:\Users\jhgwa\Anaconda3\api-ms-win-crt-filesystem-l1-1-0.dll -> build\exe.win-amd64-3.6\api-ms-win-crt-filesystem-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\jhgwa\Anaconda3\lib\site-packages\win32\lib\win32verstamp.py", line 120, in stamp
    bits = [int(i) for i in ver.split(".")]
  File "C:\Users\jhgwa\Anaconda3\lib\site-packages\win32\lib\win32verstamp.py", line 120, in <listcomp>
    bits = [int(i) for i in ver.split(".")]
ValueError: invalid literal for int() with base 10: '<any number>'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 22, in <module>
    executables = executables
  File "C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\dist.py", line 349, in setup
    distutils.core.setup(**attrs)
  File "C:\Users\jhgwa\Anaconda3\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\jhgwa\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Users\jhgwa\Anaconda3\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\jhgwa\Anaconda3\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\Users\jhgwa\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\jhgwa\Anaconda3\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\dist.py", line 219, in run
    freezer.Freeze()
  File "C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\freezer.py", line 617, in Freeze
    self._FreezeExecutable(executable)
  File "C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\freezer.py", line 226, in _FreezeExecutable
    self._AddVersionResource(exe)
  File "C:\Users\jhgwa\Anaconda3\lib\site-packages\cx_Freeze\freezer.py", line 167, in _AddVersionResource
    stamp(fileName, versionInfo)
  File "C:\Users\jhgwa\Anaconda3\lib\site-packages\win32\lib\win32verstamp.py", line 123, in stamp
    raise ValueError("--version must be a.b.c.d (all integers) - got %r" % ver)
ValueError: --version must be a.b.c.d (all integers) - got '<any number>.0.0.0'
PS C:\Users\jhgwa>
James Ward
  • 357
  • 2
  • 3
  • 11

1 Answers1

4

In the setup.py file you have to set the value of version to a string, in this example code I just set it to "1.0":

setup(
    name = '<app name>',
    options = options,
    version = "1.0",
    description = '<any description>',
    executables = executables
)

That should be enough.

Mr K.
  • 1,064
  • 3
  • 19
  • 22