code-chronicles-code / code-chronicles-code/leetcode-curriculum

Use Python 3.10 or higher to avoid error with unsupported types

Offen
#308 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @miorel Auf GitHub ansehen
bug enhancement python
Vorherrschende Sprache
TypeScript
Sterne
20
Forks
12
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

With Python 3.9 in my local setup, I've seen this error when running `yarn test`:
```
==================================== ERRORS ====================================
__________________ ERROR collecting src/is_palindrome/test.py __________________
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
:1030: in _gcd_import
???
:1007: in _find_and_load
???
:972: in _find_and_load_unlocked
???
:228: in _call_with_frames_removed
???
:1030: in _gcd_import
???
:1007: in _find_and_load
???
:986: in _find_and_load_unlocked
???
:680: in _load_unlocked
???
:850: in exec_module
???
:228: in _call_with_frames_removed
???
src/is_palindrome/__init__.py:1: in
def is_palindrome(sequence: list | str) -> bool:
E TypeError: unsupported operand type(s) for |: 'type' and 'type'
=========================== short test summary info ============================
ERROR src/is_palindrome/test.py - TypeError: unsupported operand type(s) for |: 'type' and 'type'
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
```
To fix it, I had to update Python to 3.11, fix local path and regenerate `.venv`.
We should:
* update our documentation when we have a chance
* maybe log which version of Python is used
@miorel please add more requirements

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.