Skip to content

NoneType and string concatenation when exporting with deleted expenses #4

@kantoniak

Description

@kantoniak

I get TypeError when running the script with Include deleted expenses? option enabled:

Traceback (most recent call last):
  File "/splitwise_export/splitwise_export.py", line 173, in <module>
    main()
  File "<redacted>/splitwise_export/splitwise_export.py", line 170, in main
    expenses_to_csv(expenses)
  File "<redacted>/splitwise_export/splitwise_export.py", line 156, in expenses_to_csv
    df['Deleted'] = df.apply(lambda row: get_user_name(row['Deleted']), axis=1)
  File "<redacted>/.local/share/virtualenvs/splitwise_export-vGNwKnlj/lib/python3.10/site-packages/pandas/core/frame.py", line 10034, in apply
    return op.apply().__finalize__(self, method="apply")
  File "<redacted>/.local/share/virtualenvs/splitwise_export-vGNwKnlj/lib/python3.10/site-packages/pandas/core/apply.py", line 837, in apply
    return self.apply_standard()
  File "<redacted>/.local/share/virtualenvs/splitwise_export-vGNwKnlj/lib/python3.10/site-packages/pandas/core/apply.py", line 965, in apply_standard
    results, res_index = self.apply_series_generator()
  File "<redacted>/.local/share/virtualenvs/splitwise_export-vGNwKnlj/lib/python3.10/site-packages/pandas/core/apply.py", line 981, in apply_series_generator    results[i] = self.func(v, *self.args, **self.kwargs)
  File "<redacted>/splitwise_export/splitwise_export.py", line 156, in <lambda>
    df['Deleted'] = df.apply(lambda row: get_user_name(row['Deleted']), axis=1)
  File "<redacted>/splitwise_export/splitwise_export.py", line 102, in get_user_name
    return user.getFirstName() + " " + user.getLastName()
TypeError: can only concatenate str (not "NoneType") to str

Exporter works fine otherwise. I added print(user) as a quick check, and in all but one invocation user == None. I'm happy to provide more details should you need any.

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