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

schwab_csv importer raises AssertionError because CSV has no title line #218

Open
kerrickstaley opened this issue Dec 29, 2023 · 1 comment

Comments

@kerrickstaley
Copy link

Summary

The CSV that I downloaded from Schwab at https://client.schwab.com/app/accounts/history doesn't have a Transactions for account... line, so I get an AssertionError when trying to import it.

To reproduce

  1. Download a CSV by going to https://client.schwab.com/app/accounts/history and clicking the download icon in the top right. The first line of the CSV should be:
    "Date","Action","Symbol","Description","Quantity","Price","Fees & Comm","Amount"
    
  2. Put the CSV in your "transactions" directory that you pass to transactions=glob(...) in your config
  3. Run beancount-import

Expected behavior

No error

Actual behavior

You get this exception:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/beancount_import/webserver.py", line 514, in _handle_reconciler_loaded
    loaded_reconciler = loaded_future.result()
                        ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/opt/homebrew/lib/python3.11/site-packages/beancount_import/thread_helpers.py", line 13, in wrapper
    f.set_result(fn(*args, **kwargs))
                 ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/beancount_import/reconcile.py", line 380, in __init__
    self._load_sources()
  File "/opt/homebrew/lib/python3.11/site-packages/beancount_import/reconcile.py", line 437, in _load_sources
    sources = self.sources = [
                             ^
  File "/opt/homebrew/lib/python3.11/site-packages/beancount_import/reconcile.py", line 438, in <listcomp>
    load_source(spec, log_status=self.reconciler.log_status)
  File "/opt/homebrew/lib/python3.11/site-packages/beancount_import/source/__init__.py", line 334, in load_source
    return m.load(source_spec, log_status=log_status)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/beancount_import/source/schwab_csv.py", line 1194, in load
    return SchwabSource(**spec, log_status=log_status)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/beancount_import/source/schwab_csv.py", line 1214, in __init__
    self.raw_entries.extend(_load_transactions(csv_filename))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/beancount_import/source/schwab_csv.py", line 1549, in _load_transactions
    assert match, title
AssertionError: "Date","Action","Symbol","Description","Quantity","Price","Fees & Comm","Amount"

> /opt/homebrew/lib/python3.11/site-packages/beancount_import/source/schwab_csv.py(1549)_load_transactions()
-> assert match, title

System info

macOS 13.3.1
Python 3.11.6
beancount-import 1.3.5

Notes

Is there is a different place I should be downloading CSVs from? If so, it should be documented in the docstring at https://github.com/jbms/beancount-import/blob/master/beancount_import/source/schwab_csv.py .

@llpamies
Copy link

+1 I have the same error

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

2 participants