FreeSimpleGUIWeb should allow newer remi version

Đang mở Phù hợp với người mới
#86 1 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
web-dev

Hướng nghiên cứu

Xác định khai báo dependency của FreeSimpleGUIWeb ghim remi và kiểm tra cách package được cài đặt. Kiểm thử phiên bản remi mới hơn với Python 3.10, bao gồm việc khởi chạy một web GUI và xác nhận trang tải mà không gặp lỗi kết nối đã được báo cáo; hoàn thành nghĩa là dependency cho phép sử dụng phiên bản hoạt động mà không cần monkeypatch.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
867
Fork
106
Merge trung bình
1 phút
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của spyoungtech/FreeSimpleGUI

Tất cả issue của spyoungtech/FreeSimpleGUI

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.