-
Notifications
You must be signed in to change notification settings - Fork 93
Description
I had a problem when installing FreeSimpleGUIWeb on Python 3.10... The remi version is bound to be <=2020.3.10, but there is a slightly newer version available 2022.7.27, which I am not sure of but I guess should work...
The problem at hand was as follows:
remi version 2020.3.10 has a bug, where it could not be loaded with python version >=3.4 (the catch phrase uses the wrong Exception in gui.py)
try:
# Python 2.6-2.7
from HTMLParser import HTMLParser
h = HTMLParser()
unescape = h.unescape
except ImportError:
# Python 3
try:
from html.parser import HTMLParser
h = HTMLParser()
unescape = h.unescape
except ImportError:
# Python 3.4+
import html
unescape = html.unescapeThe second ImportError does not catch the correct error as h.unescape is wrong not the import to HTMLParser.
So I tried to update the library (which does not work as my dependency manager states is must be <=2020.3.10). And afterwards I tried to monkeypatch the error away with:
from unittest.mock import patch
import sys
with patch.dict(sys.modules, {"html.parser":None}):
import FreeSimpleGUI as sgBut this led to a situation, where script runs as expected, but the website isn't shown and results in a connection error...
So I updated remi to 2022.7.10 (ignoring the dependency manager) and voila it works (even without the monkeypatch)
So I have not thoroughly tested it, but I think the newer version should not break things for FreeSimpleGUIWeb and would allow to install and use it on newer python versions without dirty hacks.