Skip to content

Issue with Société générale module: AttributeError 'str' object has no attribute 'bic' #9

@Daaran

Description

@Daaran

While trying to link my account in Kresus, I encountered an issue with Woob.

The first error occurred after a successful connection, while retrieving data :

[2026-02-16T19:46:25.969] [ERROR] providers/woob - Got error while running command "2": Unknown error: 'str' object has no attribute 'bic'.
Traceback (most recent call last):
File "/usr/local/share/.config/yarn/global/node_modules/kresus/build/server/providers/woob/py/main.py", line 713, in fetch
results["values"] = self.get_transactions(from_date)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/share/.config/yarn/global/node_modules/kresus/build/server/providers/woob/py/main.py", line 596, in get_transactions
for hist_tr in self.backend.iter_history(account):
File "/home/user/data/woob-data/modules/3.7/woob_modules/societegenerale/browser.py", line 688, in iter_history
yield from self.page.iter_history(
File "/usr/local/lib/python3.11/dist-packages/woob/browser/pages.py", line 84, in inner
for r in func(page, *args, **kwargs):
File "/usr/local/lib/python3.11/dist-packages/woob/browser/elements.py", line 281, in iter
for obj in item:
File "/usr/local/lib/python3.11/dist-packages/woob/browser/elements.py", line 467, in iter
self.parse(self.el)
File "/home/user/data/woob-data/modules/3.7/woob_modules/societegenerale/pages/accounts_list.py", line 725, in parse
and recipient.iban.bic == m["BIC"]
^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'bic'

I managed to fix this on my instance by modifying and recipient.iban.bic == m["BIC"] to and (recipient.iban.bic if hasattr(recipient.iban, 'bic') else None) == m["BIC"] to check if the recipient.iban has attribute

The first issue patched led me to a second one :

2026-02-16 20:26:28,307:ERROR:woob_modules.societegenerale.pages.accounts_list.parse_outgoing_transfer_transaction:accounts_list.py:620:parse_outgoing_transfer_transaction Transaction 000001 VIR INSTANTANE EMIS LOGITEL POUR:[recipient] DATE: 02/01/2026 10:07 REF: XXX REF: XXX CHEZ: TRBKFRPPXXX refers to non-existing BIC TRBKFRPPXXX
[2026-02-16T20:26:28.451] [INFO] providers/woob - Command returned an error code.
[2026-02-16T20:26:28.452] [INFO] providers/woob - Checking that woob is installed and can actually be called…
[2026-02-16T20:26:28.452] [INFO] providers/woob - Calling woob: command test...
[2026-02-16T20:26:28.865] [INFO] providers/woob - exited with code 0.
[2026-02-16T20:26:28.866] [INFO] providers/woob - OK: woob exited normally with non-empty JSON content.
[2026-02-16T20:26:28.866] [ERROR] providers/woob - Got error while running command "2": Unknown error: list index out of range.
Traceback (most recent call last):
File "/usr/local/share/.config/yarn/global/node_modules/kresus/build/server/providers/woob/py/main.py", line 713, in fetch
results["values"] = self.get_transactions(from_date)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/share/.config/yarn/global/node_modules/kresus/build/server/providers/woob/py/main.py", line 596, in get_transactions
for hist_tr in self.backend.iter_history(account):
File "/home/user/data/woob-data/modules/3.7/woob_modules/societegenerale/browser.py", line 688, in iter_history
yield from self.page.iter_history(
File "/usr/local/lib/python3.11/dist-packages/woob/browser/pages.py", line 84, in inner
for r in func(page, *args, **kwargs):
File "/usr/local/lib/python3.11/dist-packages/woob/browser/elements.py", line 281, in iter
for obj in item:
File "/usr/local/lib/python3.11/dist-packages/woob/browser/elements.py", line 467, in iter
self.parse(self.el)
File "/home/user/data/woob-data/modules/3.7/woob_modules/societegenerale/pages/accounts_list.py", line 706, in parse
m = parse_outgoing_transfer_transaction(Dict("libOpeComplet")(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/data/woob-data/modules/3.7/woob_modules/societegenerale/pages/accounts_list.py", line 632, in parse_outgoing_transfer_transaction
bankid = bic.domestic_bank_codes[0]
~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

It seems to be related to a non-existent BIC code so i changed bankid = bic.domestic_bank_codes[0] to bankid = bic.domestic_bank_codes[0] if bic.domestic_bank_codes else None to check wether the bic exist or not.
But the none type led to a final issue.

results["values"] = self.get_transactions(from_date)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/share/.config/yarn/global/node_modules/kresus/build/server/providers/woob/py/main.py", line 596, in get_transactions
for hist_tr in self.backend.iter_history(account):
File "/home/user/data/woob-data/modules/3.7/woob_modules/societegenerale/browser.py", line 688, in iter_history
yield from self.page.iter_history(
File "/usr/local/lib/python3.11/dist-packages/woob/browser/pages.py", line 84, in inner
for r in func(page, *args, **kwargs):
File "/usr/local/lib/python3.11/dist-packages/woob/browser/elements.py", line 281, in iter
for obj in item:
File "/usr/local/lib/python3.11/dist-packages/woob/browser/elements.py", line 467, in iter
self.parse(self.el)
File "/home/user/data/woob-data/modules/3.7/woob_modules/societegenerale/pages/accounts_list.py", line 706, in parse
m = parse_outgoing_transfer_transaction(Dict("libOpeComplet")(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/data/woob-data/modules/3.7/woob_modules/societegenerale/pages/accounts_list.py", line 634, in parse_outgoing_transfer_transaction
tr_data["IBAN"] = IBAN.generate(
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/schwifty/iban.py", line 153, in generate
BBAN.from_components(
File "/usr/local/lib/python3.11/dist-packages/schwifty/bban.py", line 122, in from_components
components[key] = common.clean(values.get(key, "")).zfill(range_.length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/schwifty/common.py", line 54, in clean
return _clean_regex.sub("", s).upper()
^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

To solve this, I wrapped the IBAN generation tr_data["IBAN"] = IBAN.generate( bank_code=bankid, account_code=m["IBAN"].account_code, country_code="FR", ) to if bankid: tr_data["IBAN"] = IBAN.generate( bank_code=bankid, account_code=m["IBAN"].account_code, country_code="FR", ) to avoid passing a None bankid

Disclaimer :
This patch worked for me (with some AI assistance), but I'm opening this issue so you can implement a proper fix that better fits the codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions