Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fints needs updates to collection modules for python >v3.9 (ImportError: cannot import name 'Iterable' from 'collections') #2

Open
Nixbligger opened this issue Mar 11, 2022 · 0 comments

Comments

@Nixbligger
Copy link

Nixbligger commented Mar 11, 2022

Hi,
I am facing an issue after adding the byro-fints plugin to my (almost) running docker installation:

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┏━o━━━━o━━━┓ This is byro v0.0.2 calling, running in production mode.   ┃
┃ ┣━━━o━━━o━━┫                                                            ┃
┃ ┣━━━━━━━━━━┫ Settings:                                                  ┃
┃ ┃   byro   ┃ Read from: byro.cfg                                        ┃
┃ ┗━━━━━━━━━━┛ Logging:   /var/byro/data/logs                             ┃
┃              Plugins:   byro_fints,byro_gemeinnuetzigkeit               ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/byro/byro/__main__.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/usr/local/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.10/site-packages/django/apps/registry.py", line 122, in populate
    app_config.ready()
  File "/byro/local/byro-fints/byro_fints/__init__.py", line 18, in ready
    from . import urls  # NOQA
  File "/byro/local/byro-fints/byro_fints/urls.py", line 3, in <module>
    from . import views
  File "/byro/local/byro-fints/byro_fints/views.py", line 21, in <module>
    from fints.client import FinTS3PinTanClient, FinTSOperations, NeedTANResponse, TransactionResponse, ResponseStatus, FinTSClientMode
  File "/usr/local/lib/python3.10/site-packages/fints-3.0.1-py3.10.egg/fints/client.py", line 14, in <module>
    from .connection import FinTSHTTPSConnection
  File "/usr/local/lib/python3.10/site-packages/fints-3.0.1-py3.10.egg/fints/connection.py", line 9, in <module>
    from .message import FinTSInstituteMessage, FinTSMessage
  File "/usr/local/lib/python3.10/site-packages/fints-3.0.1-py3.10.egg/fints/message.py", line 3, in <module>
    from .formals import SegmentSequence
  File "/usr/local/lib/python3.10/site-packages/fints-3.0.1-py3.10.egg/fints/formals.py", line 3, in <module>
    from fints.fields import *
  File "/usr/local/lib/python3.10/site-packages/fints-3.0.1-py3.10.egg/fints/fields.py", line 6, in <module>
    from fints.types import Container, SegmentSequence, TypedField
  File "/usr/local/lib/python3.10/site-packages/fints-3.0.1-py3.10.egg/fints/types.py", line 1, in <module>
    from collections import Iterable, OrderedDict
ImportError: cannot import name 'Iterable' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)

As you can see from the info box, I had previously installed the gemeinnuetzigkeit plugin and the installation went well, and byro was working when fired up again.

I did some googling, and it seems, it merely requires a few code lines to fix this issue. According to this related issue comment on Azure, it might take only this few lines:

try:
    # Python <= 3.9
    from collections import Iterable
except ImportError:
    # Python > 3.9
    from collections.abc import Iterable

to be added to /fints/types.py to fix that. Unfortunately, I wasn't able to test it properly, because I didn't manage to get into the django "manage" container. I am not much a programmer, so I wouldn't know how to do this myself. Any chance one more capable than me could take over?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant