Python bindings ( Stack overflow )

Christoph Holtermann c.holtermann at gmx.de
Thu Jun 3 07:02:26 EDT 2010


 Hello !

I posted this already in february but there was no answer and it
still doesn't work correctly for me :


I have tried to get the python bindings to work. They are very
unstable for me. When I execute

gnucash-env python

python starts fine. Then I try importing gnucash

>>> import gnucash
(same with from gnucash import *)

Here problems start as I sometimes get a Stack overflow
which kills python. I found no pattern. It just happens sometimes.
Most of the times actually. When importing gnucash worked there
are no further problems and everything works fine.

I don't know how to debug this - pdb or gdb ? I'm not familiar
anymore with c and so swig.

I tried to track things down as far as i could :

>>> import gnucash_core or
>>> import gnucash_core_c or
>>> import _gnucash_core_c
result in no errors

when i run the commands in this debugging script :
http://www.dalkescientific.com/writings/diary/archive/2005/04/20/tracing_python_code.html

i get

for "import gnucash"
------------------------------------------------------------------------------------------
dbgloadgnucash.py:28:     from gnucash import *
/usr/local/lib/python2.6/site-packages/gnucash/__init__.py:6: from gnucash_core import *
/usr/local/lib/python2.6/site-packages/gnucash/gnucash_core.py:24: import gnucash_core_c
/usr/local/lib/python2.6/site-packages/gnucash/gnucash_core_c.py:7: import _gnucash_core_c
ERROR: Stack overflow
------------------------------------------------------------------------------------------

for "import gnucash_core"
------------------------------------------------------------------------------------------
dbgloadgnucash_core.py:28:     import gnucash_core
/usr/local/lib/python2.6/site-packages/gnucash/gnucash_core.py:24: import gnucash_core_c
/usr/local/lib/python2.6/site-packages/gnucash/gnucash_core_c.py:7: import _gnucash_core_c
/usr/local/lib/python2.6/site-packages/gnucash/gnucash_core_c.py:8: import new
/usr/lib/python2.6/new.py:5: """
/usr/lib/python2.6/new.py:6: from warnings import warnpy3k
/usr/lib/python2.6/new.py:7: warnpy3k("The 'new' module has been removed in Python 3.0; use the 'types' "
/usr/lib/python2.6/new.py:8:             "module instead.", stacklevel=2)
/usr/lib/python2.6/warnings.py:19:     if sys.py3kwarning:
/usr/lib/python2.6/new.py:9: del warnpy3k
/usr/lib/python2.6/new.py:11: from types import ClassType as classobj
/usr/lib/python2.6/new.py:12: from types import FunctionType as function
/usr/lib/python2.6/new.py:13: from types import InstanceType as instance
/usr/lib/python2.6/new.py:14: from types import MethodType as instancemethod
/usr/lib/python2.6/new.py:15: from types import ModuleType as module
/usr/lib/python2.6/new.py:18: try:
/usr/lib/python2.6/new.py:19:     from types import CodeType as code
/usr/local/lib/python2.6/site-packages/gnucash/gnucash_core_c.py:9: new_instancemethod = new.instancemethod
...
...
... and so on without errors
------------------------------------------------------------------------------------------

Maybe you have some ideas about this weird behaviour.

I used Python 2.6 (r26:66714, Feb  3 2009, 20:52:03) and todays svn
branch of Gnucash. The latter is r18659. It's the same with r19209.

best regards,

Christoph Holtermann
_______________________________________________
gnucash-devel mailing list
gnucash-devel at gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


More information about the gnucash-devel mailing list