spyoungtech / spyoungtech/FreeSimpleGUI

FreeSimpleGUIWeb should allow newer remi version

Open Beginner friendly
#86 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
867
Forks
106
Avg merge
1m
Merged PRs (30d)
2

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.unescape

The 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 sg

But 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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the FreeSimpleGUIWeb dependency declaration that pins remi and inspect how the package is installed. Test the newer remi version with Python 3.10, including launching a web GUI and confirming the page loads without the reported connection error; done means the dependency permits the working version without a monkeypatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.