Hello all. To create my monthly cash-flow report, I need run multiple sql (bql?) queries (one for income, tithing, savings, etc).
I would like to create a python script to automate this process. But every time I:
'
proc = subprocess.Popen('bean-query 2016-09.bc',
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)
'
The input becomes speratic, slow and just strange. Usually coming back with an error (after Ctrl-C)
'
Traceback (most recent call last):
File "/usr/local/bin/bean-query", line 2, in <module>
from beancount.query.shell import main; main()
File "/usr/local/lib/python3.5/dist-packages/beancount/query/shell.py", line 716, in main
shell_obj.cmdloop()
File "/usr/local/lib/python3.5/dist-packages/beancount/query/shell.py", line 158, in cmdloop
super().cmdloop()
File "/usr/lib/python3.5/cmd.py", line 126, in cmdloop
line = input(self.prompt)
OSError: [Errno 5] Input/output error
'
and Regretfully /usr/lib/python3.5/cmd.py is standard python code. Maybe give it another option for playing nice this way?
Is there an easier way to script bean-query (without opening and closing bean-query for every query)?
I guess I could "bean-query 2016-09 'quer1' 'query2' 'query3'" (stack all of my queries) and then just parse the output...
Any other ideas?
Matthew 7:7
Craig A.