unbeatable101
unbeatable101

Reputation: 204

Can not run .exe packed by pyinstaller

My source code

I am using pyfiglet in my project and when compiling the .exe it returns

Traceback (most recent call last):
  File "pkg_resources\__init__.py", line 358, in get_provider
KeyError: 'pyfiglet.fonts'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "Dragon_Game.py", line 5, in <module>
  File "pyfiglet\__init__.py", line 65, in figlet_format
  File "pyfiglet\__init__.py", line 820, in __init__
  File "pyfiglet\__init__.py", line 827, in setFont
  File "pyfiglet\__init__.py", line 126, in __init__
  File "pyfiglet\__init__.py", line 139, in preloadFont
  File "pkg_resources\__init__.py", line 1133, in resource_exists
  File "pkg_resources\__init__.py", line 360, in get_provider
ModuleNotFoundError: No module named 'pyfiglet.fonts'

I can't seem to figure out why it won't work, the .py and .pyc files work fine.

Upvotes: 0

Views: 736

Answers (1)

cbolwerk
cbolwerk

Reputation: 430

You should probably add pyfiglet to your data list in your spec file. You can do this yourself, by editing the spec file. Otherwise, you could build with something like

pyinstaller --add-data "venv\Lib\site-packages\pyfiglet;./pyfiglet" Dragon_Game.py

Where the path leads to the pyfiglet file inside your PC/environment.

See this question.

Upvotes: 1

Related Questions