python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.28k stars 581 forks source link

Fixed import issue with bottle_websocket #731

Open chetankochiyaniya opened 2 months ago

chetankochiyaniya commented 2 months ago

Issue Summary:

When attempting to use the eel library in a Windows 11 environment with Python 3.12.0, I encountered an error where eel is unable to find the bottle.ext.websocket module, even though bottle-websocket is correctly installed in the Python environment.

Reproducible Example:

Minimal example demonstrating the issue

import eel

eel.init("web")
eel.start("index.html")

Expected Behavior:

I expected the script to run without errors and display the web application defined in index.html.

Actual Behavior:

Encountered the following error:

Traceback (most recent call last):
 File "main.py", line 1, in <module>
 import eel
 File "C:\Users\Chetan\AppData\Local\Programs\Python\Python312\Lib\site-packages\eel\__init__.py", line 16, in <module>
 import bottle.ext.websocket as wbs
ModuleNotFoundError: No module named 'bottle.ext.websocket'

Environment Details:

Operating System: Windows 11
Python Version: 3.12.0
eel Version: 0.16.0
bottle Version: 0.12.25
bottle-websocket Version: 0.2.9

Steps to Reproduce:

Install eel, bottle, and bottle-websocket using pip. Run the provided Python script in the specified environment.

Additional Information:

I have tried a workaround by manually modifying the init.py file in the eel package to import bottle_websocket directly, which resolved the issue temporarily.

Additional Testing:

I also tested the script on
Operating System: Windows 10
Python Version: 3.9.0
eel Version: 0.16.0
bottle Version: 0.12.25
bottle-websocket Version: 0.2.9
In both cases, the following imports worked successfully:
import bottle_websocket as wbs
# or
import bottle.ext.websocket as wbs