Database locked after crash - python bindings

Mike Evans mikee at saxicola.idps.co.uk
Sat Nov 6 08:07:04 EDT 2010


On Saturday November 6 2010 10:50:53 Christoph Holtermann wrote:
>  Hello !
> 
> > With regard to Python bindings: The error (7,) is the same if you try to
> > open a locked xml file.
> 
> Is there a description of possible error codes somewhere (in the bindings
> source for example) ? The latter seem on a auick glance just to pass them
> through.
> Are the exceptions coming from the c-code and then translated to python, so
> that I would find them in the gnucash-c-source ?
Looking at src/optional/python-bindings/gnucash_core.c most of the exceptions 
are dealt with; except for this one.   The function at line 14119 does indeed 
appear to just pass the error through.  I'm not up to the task of doing 
anything about it though.
> 
> > I'd think the python script would need to be amended to
> > trap the error and ask the user whether to continue or not.  There'd then
> > need to be some SQL to remove the lock.  It would seem to be correct
> > behaviour to stop on encountering a locked database.
> 
> Would that be an external call - like yesterday I just wrote a "script"
> echo "TRUNCATE GNCLOCK;" | mysql -u XXX --password=XXX gnucash - or is
> there or would it be useful to have a python function that does that via
> gnucash - taken that there is a function which handles that situation in
> the source ? The latter would be the code that is called by that dialogue
> which is opened by gnucash and asks you to force open. To put it in other
> words : Can that c-code be called by python ? For to me it seems more
> elegant to not have "external" calls from my skript but to have all
> commands running through the python-bindings.
I agree, it can be done by manipulating the database directly but via GnuCash 
would be better.

The bindings are maintained by Mark Jenkins, perhaps a bug needs to be opened 
if this is an issue?  
 
Mike E
> 
> regards,
> 
> Christoph Holtermann



-- 
GPG Key: 1024D/050895C2
Keyserver: http://pgp.mit.edu/          
Search String: 0x050895C2


More information about the gnucash-devel mailing list