Difference between revisions of "Python shell"

From GnuCash
Jump to: navigation, search
(Create page with information about python shell)
 
(Warning: Link to page Python Bindings)
Line 32: Line 32:
 
= Warning =
 
= Warning =
  
Be careful - if you use the python bindings in the shell to work on gnucash financial data: gnucash is not designed to have multiple instances changing the data at the same time, reading should be secure.
+
Be careful - if you use the [[Python Bindings|python bindings]] in the shell to work on gnucash financial data: gnucash is not designed to have multiple instances changing the data at the same time, reading should be secure.

Revision as of 12:57, 20 April 2019

The python shell provides a gtk window with a python shell.

Installing and Activation

Installing

Python shell comes with the python bindings. Install those.

Activation

The source of the file init.py needs to modified. When compiling gnucash from source it can be done beforehand. If installing from packages the installed file needs to be changed. It may be at different places depending on your distribution / the way it has been installed - something like "local/share/gnucash/python/init.py". "which gnucash" to locate the gnucash binary may be a start to look for it.

init.py

# Change this to "if True:" to switch on a python console at gnucash
# startup:
# shelltype can either be "python" or "ipython" (the latter is not yet fully functional)
if False:

Change to

if True:

Location

In the source tree the shell is at gnucash/python (while the python bindings are at bindings/python).

Configuration

The shell provides a python and an ipython interface. Just now only the python shell is working. Ipython had some major API-changes in Version 5.

Warning

Be careful - if you use the python bindings in the shell to work on gnucash financial data: gnucash is not designed to have multiple instances changing the data at the same time, reading should be secure.