I created a script that uses inquirer, but when I created the executable, the importation doesn’t work.
Simplified the code to just the importation.
import inquirer
And generate the executable with the command.
pyinstaller --onefile --hidden-import=inquirer .test.py
and
pyinstaller --onefile --hidden-import=inquirer --hidden-import=readchar .test.py
Error exe:
.test.exe
Traceback (most recent call last):
File "importlibmetadata__init__.py", line 563, in from_name
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 1, in <module>
File "PyInstallerloaderpyimod02_importers.py", line 419, in exec_module
File "inquirer__init__.py", line 1, in <module>
File "PyInstallerloaderpyimod02_importers.py", line 419, in exec_module
File "inquirerprompt.py", line 2, in <module>
File "PyInstallerloaderpyimod02_importers.py", line 419, in exec_module
File "inquirerrender__init__.py", line 1, in <module>
File "PyInstallerloaderpyimod02_importers.py", line 419, in exec_module
File "inquirerrenderconsole__init__.py", line 6, in <module>
File "PyInstallerloaderpyimod02_importers.py", line 419, in exec_module
File "inquirerevents.py", line 1, in <module>
File "PyInstallerloaderpyimod02_importers.py", line 419, in exec_module
File "readchar__init__.py", line 6, in <module>
File "importlibmetadata__init__.py", line 1009, in version
File "importlibmetadata__init__.py", line 982, in distribution
File "importlibmetadata__init__.py", line 565, in from_name
importlib.metadata.PackageNotFoundError: No package metadata was found for readchar
[23340] Failed to execute script 'test' due to unhandled exception!
I tried with Python versions 3.11.9 and 3.12.1.
venv yes
inquirer 3.2.4
New contributor
Jhorman Traslaviña is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.