lune-stone / anki-addon-limit-new-by-young

An add-on for Anki that can aid in maintaining a stable and efficient daily workload.
GNU Affero General Public License v3.0
7 stars 4 forks source link

Add-on Startup Failed: value: int | float TypeError: unsupported operand type(s) for |: 'type' and 'type' #15

Closed aleksejrs closed 7 months ago

aleksejrs commented 7 months ago
Anki 24.04.2 (a1fa865b)  (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Linux-6.6.15-amd64-x86_64-with-glibc2.37

When loading Limit New by Young:
Traceback (most recent call last):
  File "aqt.addons", line 247, in loadAddons
  File "/home/user/.local/share/Anki2/addons21/214963846/__init__.py", line 257, in <module>
    class UtilizationRow:
  File "/home/user/.local/share/Anki2/addons21/214963846/__init__.py", line 260, in UtilizationRow
    value: int | float
TypeError: unsupported operand type(s) for |: 'type' and 'type'

python3 -v: Python 3.11.8 (main, Feb 7 2024, 21:52:08) [GCC 13.2.0] on linux

lune-stone commented 7 months ago

Python 3.9.18

Looks like an issue with my use of modern union typing which was added with python 3.10. I think I have what should be the fix on the type-error-regression branch. If you can, let me know if it works. There are a few other things I can try if it does not.

aleksejrs commented 7 months ago

Python 3.9.18

But I have 3.11.0 installed in my Debian. Does anki-24.04.2beta1-linux-qt6 contain 3.9.18? Here is the list of all the files matching "*python*" in its directory:

lib/charset_normalizer/md.cpython-39-x86_64-linux-gnu.so
lib/charset_normalizer/md__mypyc.cpython-39-x86_64-linux-gnu.so
lib/google/protobuf/internal/python_message.py
lib/markupsafe/_speedups.cpython-39-x86_64-linux-gnu.so
lib/orjson/orjson.cpython-39-x86_64-linux-gnu.so
lib/pvectorc.cpython-39-x86_64-linux-gnu.so
lib/PyQt6/sip.cpython-39-x86_64-linux-gnu.so
lib/wrapt/_wrappers.cpython-39-x86_64-linux-gnu.so
aleksejrs commented 7 months ago

Adding from __future__ import annotations worked.

lune-stone commented 7 months ago

Does anki-24.04.2beta1-linux-qt6 contain 3.9.18?

That would be my guess.