$ ledger-autosync -l 2019.ledger -a "Liabilities:CreditCard:Citi:Costco" --unknown-account "Expenses:Stuff" ~/Downloads/Last\ year\ \(2019\).QFX >> 2019.ledger
While parsing value expression:
(tag("AutosyncPayee") == "IKE"S FOOD & COCKTAILS")&((account =~ /Liabilities:CreditCard:Citi:Costco/))
^
Error: Invalid token '<ident 'S'>' (wanted ')')
Traceback (most recent call last):
File "/usr/local/bin/ledger-autosync", line 8, in <module>
sys.exit(run())
File "/usr/local/lib/python3.7/site-packages/ledgerautosync/cli.py", line 363, in run
import_ofx(ledger, args)
File "/usr/local/lib/python3.7/site-packages/ledgerautosync/cli.py", line 183, in import_ofx
print_results(converter, ofx, ledger, txns, args)
File "/usr/local/lib/python3.7/site-packages/ledgerautosync/cli.py", line 74, in print_results
print(converter.convert(txn).format(args.indent))
File "/usr/local/lib/python3.7/site-packages/ledgerautosync/converter.py", line 436, in convert
payee=self.format_payee(txn),
File "/usr/local/lib/python3.7/site-packages/ledgerautosync/converter.py", line 326, in format_payee
payee = self.lgr.get_autosync_payee(payee, self.name)
File "/usr/local/lib/python3.7/site-packages/ledgerautosync/ledgerwrap.py", line 181, in get_autosync_payee
r = self.run(q)
File "/usr/local/lib/python3.7/site-packages/ledgerautosync/ledgerwrap.py", line 160, in run
universal_newlines=True).splitlines(),
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 411, in check_output
**kwargs).stdout
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ledger', '--args-only', '-f', '2019.ledger', 'csv', 'Liabilities:CreditCard:Citi:Costco', '--last', '1', '--format', '%(quoted(payee))\n', '--limit', 'tag("AutosyncPayee") == "IKE"S FOOD & COCKTAILS"']' returned non-zero exit status 1.
The easiest workaround was to just… replace the " with ' in the source QFX file but it would be nice if ledger-autosync handled that automatically or provided an option that sanitizes payee names before they are queried against the tx record.
The easiest workaround was to just… replace the
"
with'
in the source QFX file but it would be nice if ledger-autosync handled that automatically or provided an option that sanitizes payee names before they are queried against the tx record.