[IPython-user] c++-embedded ipython not preserving history (is in shadowhist only)

Václav Šmilauer eudoxos@arcig...
Wed Sep 24 03:38:08 CDT 2008


> Ipython saves the readline history in "atexit" handler
> (atexit_operations()). It was not run because the python interpreter
> was not destroyed (and atexit handler not run). If you are running
> from python code, atexit handler still gets run when the python
> process is ended.
>   
I found out the cause for atexit handlers not being run: they are
normally run by Py_Finalize() which I had to comment out, since it
crashes with boost::python
(http://www.boost.org/doc/libs/1_36_0/libs/python/todo.html#pyfinalize-safety).
> Perhaps you can try modding iplib.py by adding
> self.atexit_operations() in the end of interact() after while loop.
>   
I added this (after IPShellEmbed call returns):

 ipshell()
 import IPython.ipapi
 IPython.ipapi.get().IP.atexit_operations()

and it works just fine.

Thanks!

VŠ


More information about the IPython-user mailing list