1

I am trying to build an app using eel library (app.py).

My file imports two more .py files from the "utils" folder in the same directory. The html and css files are located in the "web" folder in the same directory.

I am using the following command in CMD to build the app:

python -m eel app.py web --onedir --windowed --icon

The app builds without any errors, but an error occurs when I try to launch the .exe file.

Traceback (most recent call last):
    File "app.py", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
    File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
    File "eel\__init__.py", line 15, in <module>
    File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
    File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
    File "bottle.py", line 73, in <module>
AttributeError: 'NoneType' object has no attribute 'write'

Has anyone faced with the same issue before and knows how to fix it? Thank you.

The app.py works normally when not launched as an executable.

  • 1
    Does this answer your question? [Why does .exe built using pyinstaller isn't working?](https://stackoverflow.com/questions/75232011/why-does-exe-built-using-pyinstaller-isnt-working) – Alexander Mar 08 '23 at 02:23
  • I added the lines at my code, but it still does not work. The weird thing is that it works when built without --windowed, but does not work otherwise. Any other idea? – Al-Qorasani Mar 08 '23 at 12:41
  • 1
    You need to add those lines as close you your apps entry point as possible. Before importing eel – Alexander Mar 08 '23 at 18:34
  • Oh right. Sorry for the confusion. It works exactly as you have stated. Thank you very much for the answer. – Al-Qorasani Mar 09 '23 at 04:01

0 Answers0