I am new to python and pyglet, so this could be trivial question, but i was not able to find a solution so far. I am trying to export my application to a .exe with pyinstaller. I am able to create a .exe with the command
pyinstaller --hidden-import pkg_resources.py2_warn GameWindow.py
However, when i try to execute the GameWindow.exe i get several errors and the following traceback
Traceback (most recent call last):
File "site-packages\pyglet\__init__.py", line 334, in __getattr__
AttributeError: 'NoneType' object has no attribute 'StaticSource'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "GameWindow.py", line 294, in <module>
File "site-packages\pyglet\__init__.py", line 340, in __getattr__
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\users\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\pyglet\media\__init__.py", line 143, in <module>
File "site-packages\pyglet\media\codecs\__init__.py", line 175, in add_default_media_codecs
File "site-packages\pyglet\media\codecs\__init__.py", line 128, in add_decoders
File "site-packages\pyglet\media\codecs\wmf.py", line 881, in get_decoders
File "site-packages\pyglet\media\codecs\wmf.py", line 829, in __init__
File "_ctypes/callproc.c", line 935, in GetResult
OSError: [WinError -2147417850] Cannot change thread mode after it is set
[11808] Failed to execute script GameWindow
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\users\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\pyglet\media\__init__.py", line 143, in <module>
File "site-packages\pyglet\media\codecs\__init__.py", line 175, in add_default_media_codecs
File "site-packages\pyglet\media\codecs\__init__.py", line 128, in add_decoders
File "site-packages\pyglet\media\codecs\wmf.py", line 881, in get_decoders
File "site-packages\pyglet\media\codecs\wmf.py", line 829, in __init__
File "_ctypes/callproc.c", line 935, in GetResult
OSError: [WinError -2147417850] Cannot change thread mode after it is set
Exception ignored in: <function WMFDecoder.__del__ at 0x000002594E230318>
Traceback (most recent call last):
File "site-packages\pyglet\media\codecs\wmf.py", line 876, in __del__
AttributeError: 'WMFDecoder' object has no attribute 'MFShutdown'
Exception ignored in: <function WMFDecoder.__del__ at 0x000002594E230318>
Traceback (most recent call last):
File "site-packages\pyglet\media\codecs\wmf.py", line 876, in __del__
AttributeError: 'WMFDecoder' object has no attribute 'MFShutdown'
i tried to use pyinstaller --hidden-import=['pkg_resources.py2_warn', 'WMFDecoder.MFShutdown'] GameWindow.py
, but doesn't help.
Do you have any suggestion on how to solve this issue?