pyinstaller error: ModuleNotFoundError: No module named '__builtin__'

54 views Asked by At

I'm making a desktop application in python, in which I use the speedtest-cli library. I decided to build my project in exe format using pyinstaller (I use the GUI version - auto-py-to-exe). When I build the project in exe and open main.py, I get this error:

Traceback (most recent call last):
  File "speedtest.py", line 156, in <module>
ModuleNotFoundError: No module named '__builtin__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "speedtest_thread.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "speedtest.py", line 179, in <module>
  File "speedtest.py", line 166, in __init__
AttributeError: 'NoneType' object has no attribute 'fileno'

Here's a screenshot of my problem: Error pyinstaller speedtest-cli

I know the problem has been dealt with before, here is a link to a similar discussion: Pyinstaller speedtest convert to exe error; no module name "__builtin__"

but I understood it was not solved, maybe something has changed now?

I tried changing __builtin__ to builtins, but still it didn't help.

If it helps I'm using python 3.12.1.

0

There are 0 answers