poljar / weechat-matrix

Weechat Matrix protocol script written in python
Other
961 stars 121 forks source link

(Py3.10) Error on loading: TypeError: TypeChecker() takes no arguments #293

Open sanjayankur31 opened 3 years ago

sanjayankur31 commented 3 years ago

Hello,

I upgraded to Fedora 35 (to be released soon, in beta now) to get to Python 3.10 since the bug in Python 3.9 prevents me from using weeslack and weechat-matrix together (https://github.com/wee-slack/wee-slack/issues/812). However, on this newly upgrade system, I'm running into these errors on loading the script:

             | "$HOME/Sync/99_private/weechat/python/autoload/matrix.py", line 53, in <module>
09:31:37     | python: stdout/stderr (?):     from nio import RemoteProtocolError,
             | RemoteTransportError, TransportType
09:31:37     | python: stdout/stderr (?):   File "/usr/lib/python3.10/site-packages/nio/__init__.py",
             | line 2, in <module>
09:31:37     | python: stdout/stderr (?):     from .client import *
09:31:37     | python: stdout/stderr (?):   File
             | "/usr/lib/python3.10/site-packages/nio/client/__init__.py", line 3, in <module>
09:31:37     | python: stdout/stderr (?):     from .base_client import Client, ClientConfig
09:31:37     | python: stdout/stderr (?):   File
             | "/usr/lib/python3.10/site-packages/nio/client/base_client.py", line 35, in <module>
09:31:37     | python: stdout/stderr (?):     from ..crypto import ENCRYPTION_ENABLED
09:31:37     | python: stdout/stderr (?):   File
             | "/usr/lib/python3.10/site-packages/nio/crypto/__init__.py", line 32, in <module>
09:31:37     | python: stdout/stderr (?):     from .key_request import OutgoingKeyRequest
09:31:37     | python: stdout/stderr (?):   File
             | "/usr/lib/python3.10/site-packages/nio/crypto/key_request.py", line 21, in <module>
09:31:37     | python: stdout/stderr (?):     from ..responses import RoomKeyRequestResponse
09:31:37     | python: stdout/stderr (?):   File "/usr/lib/python3.10/site-packages/nio/responses.py",
             | line 26, in <module>
09:31:37     | python: stdout/stderr (?):     from jsonschema.exceptions import SchemaError,
             | ValidationError
09:31:37     | python: stdout/stderr (?):   File
             | "/usr/lib/python3.10/site-packages/jsonschema/__init__.py", line 21, in <module>
09:31:37     | python: stdout/stderr (?):     from jsonschema._types import TypeChecker
09:31:37     | python: stdout/stderr (?):   File
             | "/usr/lib/python3.10/site-packages/jsonschema/_types.py", line 168, in <module>
09:31:37     | python: stdout/stderr (?):     draft3_type_checker = TypeChecker(
09:31:37     | python: stdout/stderr (?): TypeError: TypeChecker() takes no arguments
09:31:37 =!= | python: unable to parse file
             | "$HOME/Sync/99_private/weechat/python/autoload/matrix.py"
09:31:37     | Connecting to 3 slack teams.
09:31:37     | python scripts loaded: autosort, colorize_nicks, go, notify_send, slack, urlgrab
09:31:37     | perl scripts loaded: highmon
09:31:37     | script: 366 scripts for WeeChat 3.2
09:31:37     | Plugins loaded: alias, buflist, charset, exec, fifo, fset, guile, irc, logger, lua,
             | perl, python, relay, ruby, script, spell, tcl, trigger, xfer

I can run the import command just fine in python:

from nio import RemoteProtocolError, RemoteTransportError, TransportType
# all good, no errors here

So maybe it's something related to my upgrade (some pyc or __pycache__ files still referring to older versions or something) but I can't figure out how to go about debugging this. Any hints please?

Here's the system info:

$ pwd
$HOME/.weechat/python
$ tree 
.
├── autoload
│   ├── autosort.py -> ../autosort.py
│   ├── colorize_nicks.py -> ../colorize_nicks.py
│   ├── go.py -> ../go.py
│   ├── matrix.py -> $HOME/Documents/02_Code/01_others/weechat-matrix/main.py
│   ├── notify_send.py -> ../notify_send.py
│   ├── slack.py -> ../slack.py
│   └── urlgrab.py -> ../urlgrab.py
├── autosort.py
├── colorize_nicks.py
├── go.py
├── matrix -> $HOME/Documents/02_Code/01_others/weechat-matrix/matrix
├── matrix.py -> $HOME/Documents/02_Code/01_others/weechat-matrix/main.py
├── notify_send.py
├── slack.py
└── urlgrab.py

2 directories, 14 files
ElDifinitivo commented 3 years ago

I've just come across the same issue. Void Linux just recently upgraded to python 3.10.0 and I can't feasibly downgrade back to 3.9. Using a virtualenv doesn't work either due to incompatibilities between versions.

I'm also at a loss of what it could be. I don't think it's due to any .pyc files, cleared any cache I could find and it didn't change anything.

09:22 python: loading script "/home/<user>/bin/projects/dotfiles/.weechat/python/matrix.py"
09:22 python: stdout/stderr (?): Traceback (most recent call last):
09:22 python: stdout/stderr (?):   File "/home/<user>/bin/projects/dotfiles/.weechat/python/matrix.py", line 53, in <module>
09:22 python: stdout/stderr (?):     from nio import RemoteProtocolError, RemoteTransportError, TransportType
09:22 python: stdout/stderr (?):   File "/home/<user>/.local/lib/python3.10/site-packages/nio/__init__.py", line 2, in <module>
09:22 python: stdout/stderr (?):     from .client import *
09:22 python: stdout/stderr (?):   File "/home/<user>/.local/lib/python3.10/site-packages/nio/client/__init__.py", line 3, in <module>
09:22 python: stdout/stderr (?):     from .base_client import Client, ClientConfig
09:22 python: stdout/stderr (?):   File "/home/<user>/.local/lib/python3.10/site-packages/nio/client/base_client.py", line 35, in <module>
09:22 python: stdout/stderr (?):     from ..crypto import ENCRYPTION_ENABLED
09:22 python: stdout/stderr (?):   File "/home/<user>/.local/lib/python3.10/site-packages/nio/crypto/__init__.py", line 32, in <module>
09:22 python: stdout/stderr (?):     from .key_request import OutgoingKeyRequest
09:22 python: stdout/stderr (?):   File "/home/<user>/.local/lib/python3.10/site-packages/nio/crypto/key_request.py", line 21, in <module>
09:22 python: stdout/stderr (?):     from ..responses import RoomKeyRequestResponse
09:22 python: stdout/stderr (?):   File "/home/<user>/.local/lib/python3.10/site-packages/nio/responses.py", line 26, in <module>
09:22 python: stdout/stderr (?):     from jsonschema.exceptions import SchemaError, ValidationError
09:22 python: stdout/stderr (?):   File "/usr/lib/python3.10/site-packages/jsonschema/__init__.py", line 21, in <module>
09:22 python: stdout/stderr (?):     from jsonschema._types import TypeChecker
09:22 python: stdout/stderr (?):   File "/usr/lib/python3.10/site-packages/jsonschema/_types.py", line 168, in <module>
09:22 python: stdout/stderr (?):     draft3_type_checker = TypeChecker(
09:22 python: stdout/stderr (?): TypeError: TypeChecker() takes no arguments
09:22 =!= python: unable to parse file "/home/<user>/bin/projects/dotfiles/.weechat/python/matrix.py"

Versions:

olm:                    3.2.4_1
olm-devel:              3.2.4_1
olm-python3:            3.2.4_2
python3-openssl:        20.0.1_2
python3-atomicwrites:   1.4.0_2
python3-logbook:        1.5.3_3
python3-jsonschema:     3.2.0_2
python3-hyper-h2:       4.0.0_2
python3-h11:            0.12.0_2
python3-cachetools:     4.2.4_2
python3-peewee:         3.14.4_2
python3-aiohttp:        3.7.4_3
python3-future:         0.18.2_5
python3-attrs:          21.2.0_2
python3-Pygments:       2.10.0_2
python3-magic:          0.4.18_5
python3-requests:       2.26.0_2
thebeardedpapi commented 3 years ago

+1 - same issue as the description. On Fedora 35, with python 3.10.0

I've tried python 3.9, 3.7 and 2.7, they all give me different errors when trying to load matrix.py in weechat.

thatnerdjosh commented 2 years ago

I spent many hours today looking into this without much success :(... however I did make a docker image and summary of what I found in case anyone wants an easy way to reproduce it

https://github.com/thatnerdjosh/reproduceable-envs/tree/main/weechat-matrix-293

yalla commented 2 years ago

Having the same problem and can't seem to find any way around it. Suggestions?

hroncok commented 2 years ago

I believe this is a bug in Python subinterpreters: https://bugs.python.org/issue46034

diabonas commented 2 years ago

I confirm that applying cmp_interned_strings.patch attached to the upstream Python issue bpo-46006 on top of Python 3.10.1 fixes the issue when trying to load the weechat-matrix script.

Zapeth commented 2 years ago

I no longer get this error with python 3.10.2 (void linux)