Error calling Python API's session.save()

John Ralls jralls at ceridwen.us
Wed Feb 20 10:47:53 EST 2013


On Feb 19, 2013, at 11:13 PM, James Nylen <jnylen+gnucash at gmail.com> wrote:

> Hi all,
> 
> I wasn't sure whether this should go to gnucash-user or gnucash-devel, so
> I'm sending to both.  But I'm experiencing an issue with the Python API on
> a fresh install of Linux Mint - an error calling Session.save().  Even
> though it looks like my changes are successfully being saved, this is
> worrisome.
> 
> Below is a terminal log that illustrates the problem:
> 
> ===== begin gnucash-terminal-log.txt =====
> 
> user at computron ~ $ ipython
> Python 2.7.3 (default, Sep 26 2012, 21:51:14)
> Type "copyright", "credits" or "license" for more information.
> IPython 0.13.1.rc2 -- An enhanced Interactive Python.
> ?         -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help      -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
> 
> In [1]: from gnucash import *
> 
> In [2]: session = Session('mysql://redacted:redacted@redacted/redacted')
> 
> In [3]: session.save()
> * 02:03:41  CRIT <gnc.backend.dbi> [mysql_error_fn()] DBI error: 1064: You
> have
> an error in your SQL syntax; check the manual that corresponds to your
> MySQL
> server version for the right syntax to use near '' at line 1
> ---------------------------------------------------------------------------
> GnuCashBackendException                   Traceback (most recent call last)
> <ipython-input-3-0e2bfeaf02ea> in <module>()
> ----> 1 session.save()
> 
> /usr/local/lib/python2.7/dist-packages/gnucash/gnucash_core.py in
> new_function(self, *args)
>    142         def new_function(self, *args):
>    143             return_value = function(self, *args)
> --> 144             self.raise_backend_errors(function.__name__)
>    145             return return_value
>    146         return new_function
> 
> /usr/local/lib/python2.7/dist-packages/gnucash/gnucash_core.py in
> raise_backend_errors(self, called_function)
>    120                 "call to %s resulted in the "
>    121                 "following errors, %s" % (called_function,
> backend_error_dict[errors[0]]),
> --> 122                 errors )
>    123
>    124     def generate_errors(self):
> 
> GnuCashBackendException: call to new_function resulted in the following
> errors,
> ERR_BACKEND_SERVER_ERR
> 
> In [4]: session.end()
> 
> In [5]: session.destroy()
> * 02:03:55  CRIT <GLib> g_hash_table_foreach: assertion `version ==
> hash_table->version' failed
> 
> In [6]:
> Do you really want to exit ([y]/n)? y
> 
> user at computron ~ $ gnucash --version
> GnuCash 2.4.11
> Built 2013-02-18 from r22264M
> 
> user at computron ~ $ cat /etc/lsb-release
> DISTRIB_ID=LinuxMint
> DISTRIB_RELEASE=14
> DISTRIB_CODENAME=nadia
> DISTRIB_DESCRIPTION="Linux Mint 14 Nadia"
> 
> user at computron ~ $ uname -a
> Linux computron 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012
> x86_64 x86_64 x86_64 GNU/Linux
> 
> ===== end gnucash-terminal-log.txt =====
> 
> I'd appreciate some help with this.  What other information can I provide,
> if any?


We'll need to know what the actual sql is and where it's coming from, so set up your python program to capture logs and set the gnc.backend.sql domain loglevel to debug. Make the error happen again and examine the resulting log to figure out the source and nature of the error, then report back.

Regards,
John Ralls




More information about the gnucash-devel mailing list