Issue #220: bean-query fails importing readline on native Windows (blais/beancount)

26 views
Skip to first unread message

Jeff Brantley

unread,
Feb 24, 2018, 5:51:02 PM2/24/18
to bean...@googlegroups.com
New issue 220: bean-query fails importing readline on native Windows
https://bitbucket.org/blais/beancount/issues/220/bean-query-fails-importing-readline-on

Jeff Brantley:

When running natively on Windows, bean-query fails to launch because beancount.query.shell uses readline, which is unavailable.

I have experimented with the following options:
1. Make readline optional by catching ImportError and setting the value of a file-level variable has_readline, then condition the body of each file-level function using readline on whether has_readline. I was able to run a sample query this way, and Windows CMD naturally provides program-scoped history across multiple bean-query runs until I exit the CMD instance, which is similar to the python shell behavior.

2. Install pyreadline (pip install pyreadline) and run bean-query without modification. This worked, too, and resulted in history persisting across instances of CMD.

Question: does beancount provide any facility for explicitly-saved (e.g., with a nickname) queries for later recall, or is the readline-style history the sole mechanism? I guess one could at least write a wrapper script that does a one-shot call to bean-query...

So, I see the following options:
1. Adopt approach #1. Simple. Impact could be mitigated by writing wrapper scripts to invoke bean-query with favorite queries. Does beancount have a feature for saved queries?

2. Depend on pyreadline explicitly on Windows. I haven't looked into whether a conditional dependency is difficult. FWIW, the project is abandoned.

3. Do approach #1, but log a warning about it with a suggestion to install pyreadline, leaving it to the user's discretion.

@blais , would you like to weigh in? I'm happy to do the work.


Reply all
Reply to author
Forward
0 new messages