Syntax-Wechsel zwischen Python 3.9.10 und 3.10.7 / module 'collections' has no attribute 'Callable'?
Verfasst: Mittwoch 5. Oktober 2022, 18:08
Ähnlich wie bereits unter Linux Debian 12/bookworm möchte ich Karl Voit's Anwendung filetags (https://github.com/novoid/filetags) auch unter Windows anwenden. In Linux ist die Installation und Anwendung als eine benutzerdefinierte Aktion im Dateimanager Thunar (4.16.10, Xfce4 DE) Python 3.10.7 problemlos. Ebenso -- bisher -- in Windows 10, 32 bit, mit Python 3.9.10 (https://github.com/novoid/filetags/issues/49).
Obwohl während der Installation in Windows 10, 32 bit mit gegenwärtigem Python 3.10.7, oder python-3.11.0rc2 keine Fehlermeldung auftaucht, ist der gleiche Quellcode nicht (mehr) ausführbar. Wenn etwa die `__init.py__` Datei als `filetags.py` auf dem Desktop abgelegt wird, und über die Kommandozeile
aufgerufen wird, beschreibt cmd.exe zahlreiche Probleme (siehe unten). Meine Frage ist deshalb, ob es vielleicht seit Veröffentlichung von Python 3.9.10 für Windows einen (gegenüber dem Einsatz unter Linux) veränderten Syntax gibt, der im Quellcode zu berücksichtigen wäre, um die Anwendung wieder zum laufen zu bringen. (`$username` ist hier nur ein Platzhalter für das Nutzerkonto.)
Obwohl während der Installation in Windows 10, 32 bit mit gegenwärtigem Python 3.10.7, oder python-3.11.0rc2 keine Fehlermeldung auftaucht, ist der gleiche Quellcode nicht (mehr) ausführbar. Wenn etwa die `__init.py__` Datei als `filetags.py` auf dem Desktop abgelegt wird, und über die Kommandozeile
Code: Alles auswählen
python filetags --help
Code: Alles auswählen
C:\Users\$username\Desktop>python filetags.py --help
Traceback (most recent call last):
File "C:\Users\$username\Desktop\filetags.py", line 51, in <module>
save_import('readline') # for raw_input() reading from stdin
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\$username\Desktop\filetags.py", line 35, in save_import
globals()[library] = import_module(library)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\$username\AppData\Local\Programs\Python\Python311-32\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\$username\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\readline.py", line 34, in <module>
rl = Readline()
^^^^^^^^^^
File "C:\Users\$username\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pyreadline\rlmain.py", line 422, in __init__
BaseReadline.__init__(self)
File "C:\Users\$username\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pyreadline\rlmain.py", line 62, in __init__
mode.init_editing_mode(None)
File "C:\Users\$username\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
self._bind_key('space', self.self_insert)
File "C:\Users\$username\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
if not callable(func):
^^^^^^^^^^^^^^
File "C:\Users\$username\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pyreadline\py3k_compat.py", line 8, in callable
return isinstance(x, collections.Callable)
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Callable'
C:\Users\$username\Desktop>