CyberSource / CyberSource/cybersource-rest-client-python

Exception: Callable has no attribute __abc_registry

Offen
#20 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
24
Forks
42
Ø Merge
29 Min.
Gemergte PRs (30 T.)
1

Beschreibung

Expected Behavior

Cybersource-REST-Client-Python should work with the Python 3.7.

Actual Behavior

Users receive a Callable has no attribute __abc_registry error.

This is a known issue when installing typing on a system that has Python > 3.6 because typing is in the standard library since version 3.5. Importing typing with Python 3.7 fails.

Cloudwatch Log

[ERROR] AttributeError: type object 'Callable' has no attribute '_abc_registry'
Traceback (most recent call last):
  File "/var/lang/lib/python3.7/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/var/lang/lib/python3.7/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/var/task/app.py", line 4, in <module>
    from typing import Optional
  File "/var/task/typing.py", line 1347, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/var/task/typing.py", line 1003, in __new__
    self._abc_registry = extra._abc_registry

Steps to Reproduce the Problem

  1. Installed the latest available version of the SDK through pip so it will install all required dependencies too.
  2. Create a test.py file and import the Cybersource SDK in an environment with Python > 3.5.
  3. Execute the script python or upload the code to Lambda and run it.

Suggestion for Fix

Opened a PR here: https://github.com/CyberSource/cybersource-rest-client-python/pull/21

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere den Fehler, indem du das neueste SDK mit pip installierst und den client oder typing.Optional aus test.py importierst, wobei du Python 3.7 oder Lambda wie beschrieben verwendest. Überprüfe das Verhalten der Abhängigkeiten und PR #21; abgeschlossen bedeutet, dass das SDK unter Python 3.7 erfolgreich importiert wird, ohne den Fehler Callable __abc_registry.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

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