Bug: export_transactions CSV crashes on "Aktien erhalten" event
Description
Running pytr export_transactions with CSV format crashes with an AttributeError when the timeline contains an "Aktien erhalten" (shares received) event. JSON export works fine.
Steps to reproduce
Expected behavior
CSV file is exported, unknown event types are skipped or handled gracefully.
Actual behavior
The command crashes with the following traceback:
21:44:23 Ignoring unknown event "AI & Big Data USD (Acc) Aktien erhalten (9e81acd0-3fe1-409b-abfd-96f26088eeb0)"
Traceback (most recent call last):
File ".../bin/pytr", line 12, in <module>
sys.exit(main())
File ".../pytr/main.py", line 533, in main
[Event.from_dict(item) for item in events],
File ".../pytr/event.py", line 462, in from_dict
note = cls._parse_card_note(event_dict)
File ".../pytr/event.py", line 790, in _parse_card_note
if eventTypeStr.startswith("card_"):
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'startswith'
Root cause (hypothesis)
_parse_card_note in event.py (line 790) calls .startswith() on eventTypeStr without checking if it's None first. The "Aktien erhalten" event type seems to return None for this field.
Environment
- OS: Linux
- pytr version: latest
- Login method: web login
Workaround
JSON export works fine. The data can be converted to CSV manually via pandas.
Bug:
export_transactionsCSV crashes on "Aktien erhalten" eventDescription
Running
pytr export_transactionswith CSV format crashes with anAttributeErrorwhen the timeline contains an "Aktien erhalten" (shares received) event. JSON export works fine.Steps to reproduce
Expected behavior
CSV file is exported, unknown event types are skipped or handled gracefully.
Actual behavior
The command crashes with the following traceback:
Root cause (hypothesis)
_parse_card_noteinevent.py(line 790) calls.startswith()oneventTypeStrwithout checking if it'sNonefirst. The "Aktien erhalten" event type seems to returnNonefor this field.Environment
Workaround
JSON export works fine. The data can be converted to CSV manually via pandas.