Hi, 

In beancount version 2.1.3, bean-identify (and bean-extract) now needs the 
input directory to be specified with it's full absolute path, or else it 
gives an error:


$ bean-identify  config.py input/
**** input/History.csv
Traceback (most recent call last):
  File "/usr/local/bin/bean-identify", line 4, in <module>
    from beancount.ingest.identify import main; main()
  File "/usr/local/lib/python3.7/site-packages/beancount/ingest/identify.py"
, line 104, in main
    return scripts_utils.trampoline_to_ingest(sys.modules[__name__])
  File 
"/usr/local/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", 
line 132, in trampoline_to_ingest
    return run_import_script_and_ingest(parser)
  File 
"/usr/local/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", 
line 202, in run_import_script_and_ingest
    return ingest(importers_list, abs_downloads)
  File 
"/usr/local/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", 
line 102, in ingest
    args.command(args, parser, importers_list, args.downloads)
  File "/usr/local/lib/python3.7/site-packages/beancount/ingest/identify.py"
, line 100, in run
    return identify(importers_list, files_or_directories)
  File "/usr/local/lib/python3.7/site-packages/beancount/ingest/identify.py"
, line 83, in identify
    logfile=logfile):
  File "/usr/local/lib/python3.7/site-packages/beancount/ingest/identify.py"
, line 60, in find_imports
    file = cache.get_file(filename)
  File "/usr/local/lib/python3.7/site-packages/beancount/ingest/cache.py", 
line 132, in get_file
    "Path should be absolute in order to guarantee a single call.")
AssertionError: Path should be absolute in order to guarantee a single call.

This issue is not present in beancount version 2.1.2.

I feel like the bug stems from recent changes in this commit 
<https://github.com/beancount/beancount/commit/c1364de369fee5426e68f074404c1e47d8f2e4d2#diff-6f70671aa02b1aa5c4c4a6ffb9d10285>.
 
The full path is compute in scripts_utils.py:202 
<https://github.com/beancount/beancount/blob/master/beancount/ingest/scripts_utils.py#L202>,
 
but then is replaced in the final call in scripts_utils.py:102 by 
args.download which doesn't have the full path. (Also strangely the 
function at line 102, expects its second argument as 
"detect_duplicates_func", and not a string (or list of strings) with file 
path(s)). Anyway, I hope this helps diagnose it.

I'm not sure of the complexity of the fix, though. A work around is to call 
the scripts like follows:

$ bean-identify  config.py $(pwd)/input/


Thanks,
Shreedhar

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/709141d5-88a4-444a-acef-94bf43a9b388%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to