brandon-rhodes / luca

Bookkeeping in Python
68 stars 16 forks source link

Error using "complete" command possibly due to missing PDF templates #2

Closed zrisher closed 8 years ago

zrisher commented 8 years ago

When I attempt to run the complete command on a default input file created using the form command, I'm presented with the following error:

(luca_example)ubuntu@ip-172-31-6-233:~/luca_example/2012$ luca complete 2012-f1040.json 2012-f1040.json
Traceback (most recent call last):
  File "/home/ubuntu/anaconda/envs/luca_example/bin/luca", line 11, in <module>
    sys.exit(main())
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/commandline.py", line 34, in main
    for line in _main(args, terminal):
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/commandline.py", line 64, in _main
    luca.forms.actions.complete(args['<tax-filing.json>'], not args['-j'])
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/actions.py", line 79, in complete
    pdf_path = save_pdf(json_path, form_module, form)
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/actions.py", line 126, in save_pdf
    form_module.fill_out(form, pdf)
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/us/f1040.py", line 115, in fill_out
    pdf.load('us.f1040--{}.pdf'.format(f.form_version))
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/actions.py", line 191, in load
    ['pdftk', self.original_pdf_path, 'dump_data_fields'])
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

This appears to occur because 'us.f1040--{}.pdf' is missing. I don't see any .pdf files in the repo.

Any chance I could get the required files? Or am I interpreting this incorrectly?

brandon-rhodes commented 8 years ago

The files are supposed to be downloaded from the Internet. I did my business taxes this season (Forms 940 and 941) using Luca, so I updated those for 2015, but not my personal taxes (I am not sure I will have time), so no Form 1040 PDF has been uploaded yet. Here, let me do it. —

There. Now the PDF should no longer be missing.

Note that I am not sure whether this year's form works — often, the IRS makes some small changes to the internal PDF field names and adds or removes a few lines, which means that every year a new version of the form has to be written in the code to make it able to print. Might you be interested in contributing to the project by making the adjustments for this year's 1040? If so then I can write up a little guide for you! If not, and 1040 is the only form you need, then I probably have time to update the project myself this weekend. If you need Form 1040 plus all of its schedules, though, I'm not sure if I have time — so let me know which forms you are going to try filling out, and whether you know any Python, and we'll see how we can keep this project moving forward for not just the business forms but the personal ones too!

Thanks for your interest :) I am not sure that anyone else has ever tried using it before!

zrisher commented 8 years ago

@brandon-rhodes Absolutely, my pleasure. Thanks for getting back to me on these and making such a cool tool.

Yes, I would be willing to help get this working with 2015. Please do write up whatever guidance you can provide on that.

brandon-rhodes commented 8 years ago

Since your own application is in Python, you might be interested in skipping the slightly clunky JSON mechanism that re-writes the file the user has just edited (but that I find very convenient because then, after adjusting an input, I can run the command and see the changed output values reload immediately in my browser window), and instead just have your Python app import the raw form logic itself so that you could skip doing any I/O to the disk and instead just have Luca do computations for you right in memory.

If that sounds possible, I'll be happy to write a quick API document about how the logic works!

zrisher commented 8 years ago

@brandon-rhodes Sorry, the context of my work and these issues is probably a little confusing:

I raised this issue as a user of Luca - pretend I'm just looking to use its tallying logic with my bank statements, then I translate that info to form input json and allow Luca to prepare my tax forms. This issue is blocking me from that last part.

But the actual objective of my project is to allow Luca users to take the same JSON they've give to Luca to fill out their tax forms and instead give it to taxcalc to calculate the affects a change in US tax policy would have on their individual taxes. Part of accomplishing that is understanding how someone uses Luca and what their JSON input looks like, thus bringing me to this issue. : )

brandon-rhodes commented 8 years ago

Since I think the immediate issue here is resolved (the form now downloads?), I am going to close this issue — feel free to re-open if I have misunderstood.

Note that I am probably the only user of Luca who uses it for tax forms, so your project might get less traction than you suppose by learning to integrate with it! While I use it for my business taxes, and previously for my personal taxes, I have never seen people open issues on it or otherwise indicate that anyone but me uses it!