Database locked after crash - python bindings

Christoph Holtermann c.holtermann at gmx.de
Sat Nov 6 06:50:53 EDT 2010


 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 ?
> 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.
> Mike E
>
>
regards,

Christoph Holtermann



More information about the gnucash-devel mailing list