Closed mcepl closed 2 years ago
I get the same result: I updated my pip install from master in a python virtualenv just now and when I tried to run the alembic upgrade, I get a similar error with backtrace:
$ alembic upgrade head
Traceback (most recent call last):
File "/opt/mautrix-telegram/bin/alembic", line 10, in <module>
sys.exit(main())
File "/opt/mautrix-telegram/lib/python3.7/site-packages/alembic/config.py", line 540, in main
CommandLine(prog=prog).main(argv=argv)
File "/opt/mautrix-telegram/lib/python3.7/site-packages/alembic/config.py", line 534, in main
self.run_cmd(cfg, options)
File "/opt/mautrix-telegram/lib/python3.7/site-packages/alembic/config.py", line 514, in run_cmd
**dict((k, getattr(options, k, None)) for k in kwarg)
File "/opt/mautrix-telegram/lib/python3.7/site-packages/alembic/command.py", line 279, in upgrade
script.run_env()
File "/opt/mautrix-telegram/lib/python3.7/site-packages/alembic/script/base.py", line 475, in run_env
util.load_python_file(self.dir, "env.py")
File "/opt/mautrix-telegram/lib/python3.7/site-packages/alembic/util/pyfiles.py", line 98, in load_python_file
module = load_module_py(module_id, path)
File "/opt/mautrix-telegram/lib/python3.7/site-packages/alembic/util/compat.py", line 174, in load_module_py
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "alembic/env.py", line 11, in <module>
import mautrix_telegram.db
File "/opt/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/db/__init__.py", line 18, in <module>
from mautrix.client.state_store.sqlalchemy import UserProfile, RoomState
File "/opt/mautrix-telegram/lib/python3.7/site-packages/mautrix/client/__init__.py", line 1, in <module>
from .api import ClientAPI
File "/opt/mautrix-telegram/lib/python3.7/site-packages/mautrix/client/api/__init__.py", line 6, in <module>
from .client import ClientAPI
File "/opt/mautrix-telegram/lib/python3.7/site-packages/mautrix/client/api/client.py", line 6, in <module>
from .authentication import ClientAuthenticationMethods
File "/opt/mautrix-telegram/lib/python3.7/site-packages/mautrix/client/api/authentication.py", line 9, in <module>
from mautrix.api import Method, Path
File "/opt/mautrix-telegram/lib/python3.7/site-packages/mautrix/api.py", line 127, in <module>
class HTTPAPI:
File "/opt/mautrix-telegram/lib/python3.7/site-packages/mautrix/api.py", line 215, in HTTPAPI
retry_count: Optional[int] = None) -> 'JSON':
TypeError: 'type' object is not subscriptable
Python 3.6 is not supported and it doesn't seem to happen on 3.7.10
I'm on Debian 10 (Buster), the distro packages provide Python 3.7
$ python -V
Python 3.7.4
I'll see, if I can update it to a more recent version and if that fixes the issue.
I can't reproduce it on a debian 10 docker image with python 3.7.3 either, so I'd guess there's something messed up in your environment. (why do you have 3.7.4 when the debian package is 3.7.3? :thinking:)
After switching off Python 3.6 I have just partially improved result. Now it errors with:
[ 26s] ________________ ERROR at setup of TestCommandEvent.test_reply _________________
[ 26s]
[ 26s] context = <mautrix_telegram.context.Context object at 0x7f78e7468400>
[ 26s]
[ 26s] @pytest.fixture
[ 26s] def command_processor(context: Context) -> CommandProcessor:
[ 26s] """Returns a mocked CommandProcessor."""
[ 26s] > return CommandProcessor(context)
[ 26s]
[ 26s] tests/commands/test_handler.py:35:
[ 26s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 26s] mautrix_telegram/commands/handler.py:113: in __init__
[ 26s] super().__init__(event_class=CommandEvent, bridge=context.bridge)
[ 26s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 26s]
[ 26s] self = <mautrix_telegram.commands.handler.CommandProcessor object at 0x7f78e7468040>
[ 26s] bridge = <Mock id='140157252963776'>
[ 26s] event_class = <class 'mautrix_telegram.commands.handler.CommandEvent'>
[ 26s]
[ 26s] def __init__(self, bridge: 'Bridge', event_class: Type[CommandEvent] = CommandEvent) -> None:
[ 26s] self.az = bridge.az
[ 26s] self.config = bridge.config
[ 26s] self.loop = bridge.loop or asyncio.get_event_loop()
[ 26s] > self.command_prefix = self.config["bridge.command_prefix"]
[ 26s] E TypeError: 'Mock' object is not subscriptable
[ 26s]
[ 26s] /usr/lib/python3.9/site-packages/mautrix/bridge/commands/handler.py:340: TypeError
I reset the virtualenv with virtualenv --clear -p /usr/bin/python3 .
After that I re-ran the pip install from git and the alembic upgrade finished without error and I was able to start the bridge again. So, yeah, something was screwed up in my environment.
I am obviously building in completely free and fresh environment (chrooted from the rest of the system), so screwed up environment shouldn't be a problem.
Tests have been permanently fixed now (i.e. removed)
When trying to package mautrix-telegram for openSUSE (using mautrix-python 0.9.3 and mautrix-telegram from the commit 5ed09ad), I get this complete disaster when trying to run the test suite (apparently related to #407 ;)):
Complete build log with all details of packages used, steps taken, etc.