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

Scripts return None when looking for headers "Month" and "Account" #3

Open
SgtBatten opened this issue Nov 24, 2021 · 1 comment
Open

Comments

@SgtBatten
Copy link
Contributor

Running python 3.10 on windows 10. Please trust my file names and paths are correct. Somethings not working when it tries to read the CSV as it can't find the headers properly. The budget import step at the bottom reveals it is returning None and i suspect the same issue is causing the problem with the Account splitting.

C:\Users\XXX\Desktop>C:\Users\XXX\AppData\Local\Programs\Python\Python310\python.exe split_export.py RegisterBackup.csv
Traceback (most recent call last):
  File "C:\Users\XXX\Desktop\split_export.py", line 57, in <module>
    main()
  File "C:\Users\XXX\Desktop\split_export.py", line 30, in main
    account = line.pop(account_key)
KeyError: 'Account'

As this failed i did it manually before attempting the budget import below. My transactions in YNAB 4 exactly match my nYNAB history with the only exception being split transactions are not actual splits any more (too many to fix).

C:\Users\XXX\Desktop>C:\Users\XXX\AppData\Local\Programs\Python\Python310\python.exe import_budgets.py Budget.csv "D:\Dropbox\YNAB\Our Budget~2DFXBF96.ynab4\data11-FFC65157\75C16XD9-2D38-2BD7-4A23-5F0C5048AAD7"
Traceback (most recent call last):
  File "C:\Users\XXX\Desktop\import_budgets.py", line 121, in <module>
    main()
  File "C:\Users\XXX\Desktop\import_budgets.py", line 116, in main
    budgets = load_budgets(nynab_path)
  File "C:\Users\XXX\Desktop\import_budgets.py", line 102, in load_budgets
    month = dt.datetime.strptime(month, "%b %Y").strftime("%Y-%m")
TypeError: strptime() argument 1 must be str, not None
@rixx
Copy link
Owner

rixx commented Nov 24, 2021

This is probably a file encoding issue, which would explain why it only occurs on some operating systems. I don't have access to a Windows system with Python installed at the moment, so somebody else will have to fix this one, I'm afraid. You could start by having the script print the available keys in split_export.py between L29 and L30, probably something like print(line.keys()).

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