Reputation: 31
I am trying to create a GUI in python using plain HTML, CSS, JS. I am using python eel module to create a GUI from it. When i tried to execute .py file it says module not found. Here are the code and error
main.py
import eel
eel.init("./Evo/Body/Comp")
eel.start("desktop.html")
When I execute this code by using
python main.py
It gives this error
main.py", line 1, in <module>
import eel
\Lib\site-packages\eel\__init__.py", line 16, in <module>
import bottle.ext.websocket as wbs
ModuleNotFoundError: No module named 'bottle.ext.websocket'
Earlier it was running well and fine but due to some issue i need to reset my PC. After reset when i re-installed everything then i am unable to run eel module and again and again same error occurs.
Upvotes: 2
Views: 7363
Reputation: 613
Edit with notepad++ than it will work:
C:\Users\yours\AppData\Local\Programs\Python\Python312\Lib\site-packages\eel\__init__.py
Find the exact line from your traceback:
import bottle.ext.websocket as wbs
and replace it with this one below:
import bottle_websocket as wbs
But Eel is chrome based.
Upvotes: 0
Reputation: 21
To solve this error, install bottle
using this command: pip install git+https://github.com/bottlepy/bottle.git
Upvotes: 2
Reputation: 86
If you're using Python 3.12 release, it probably broke the bottle.ext.websocket
import
According to the maintainer
As described in #433, auto-py-to-exe fails to launch when run using Python 3.12 due to a bottle issue.
auto-py-to-exe just released support for Python 3.12.
Upgrade using:
pip install auto-py-to-exe --upgrade --force-reinstall
Fortunately, bottle-websocket
can be used and should work the same.
I got mine working using Python 3.12.
You just have to change an import in __init__.py
in the eel module.
Find this import line:
import bottle.ext.websocket as wbs
and replace it with the one below:
import bottle_websocket as wbs
Make sure you have these up-to-date:
pip install --upgrade bottle-websocket setuptools
Save changes then run auto-py-to-exe
again.
Let me know if it works.
Upvotes: 5
Reputation: 588
Make sure you are using auto-py-to-exe to package your app.
After inserting necessary details (script file,, extra files etc), you would see an advanced options tab probably below, click on it to expand it, look for the hidden imports label and insert "bottle-websocket" in the input field representing the hidden imports, that's all you need to do
Upvotes: 0