1

I've been getting this error for a long time now, I've tried reinstalling and such. cx_Freeze has been working fine before I've tried to make executables out of Pygame programs. Here's the errors:

 File "setup.py", line 8, in <module>
    executables=executables
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\dist.py", line 349, in setup
    distutils.core.setup(**attrs)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\dist.py", line 219, in run
    freezer.Freeze()
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\freezer.py", line 621, in Freeze
    self.finder = self._GetModuleFinder()
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\freezer.py", line 340, in _GetModuleFinder
    finder.IncludePackage(name)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 655, in IncludePackage
    self._ImportAllSubModules(module, deferredImports)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 279, in _ImportAllSubModules
    deferredImports)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
    parentModule, namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 416, in _LoadModule
    namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 485, in _LoadPackage
    self._LoadModule(name, fp, path, info, deferredImports, parent)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 474, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 564, in _ScanCode
    module, relativeImportIndex)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 310, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
    parentModule, namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 474, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 564, in _ScanCode
    module, relativeImportIndex)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 310, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
    parentModule, namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 416, in _LoadModule
    namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 485, in _LoadPackage
    self._LoadModule(name, fp, path, info, deferredImports, parent)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 474, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 564, in _ScanCode
    module, relativeImportIndex)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 310, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
    parentModule, namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 474, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 569, in _ScanCode
    fromList, deferredImports)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 210, in _EnsureFromList
    self._ImportModule(subModuleName, deferredImports, caller)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 310, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
    parentModule, namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 416, in _LoadModule
    namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 485, in _LoadPackage
    self._LoadModule(name, fp, path, info, deferredImports, parent)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 474, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 588, in _ScanCode
    topLevel = False)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 564, in _ScanCode
    module, relativeImportIndex)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 310, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
    parentModule, namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 416, in _LoadModule
    namespace)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 485, in _LoadPackage
    self._LoadModule(name, fp, path, info, deferredImports, parent)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 463, in _LoadModule
    self._RunHook("load", module.name, module)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 536, in _RunHook
    method(self, *args)
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\hooks.py", line 613, in load_tkinter
    tclSourceDir = os.environ["TCL_LIBRARY"]
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\os.py", line 669, in __getitem__
    raise KeyError(key) from None
KeyError: 'TCL_LIBRARY'

Here's the setup:

   import cx_Freeze

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

    cx_Freeze.setup(
        name="Skillful Sky",
        options={"build_exe": {"packages": ["pygame"], "include_files": ["gameairplane.png", "gameicon.png", "gamesong.wav"]}},
        executables=executables
    )
Acapla
  • 33
  • 4

1 Answers1

0

I think this has already been answered - https://stackoverflow.com/a/35706103/7046074. Please do some research before posting and if you had tried it mention it so that people would be able understand your problem clearly.