[IPython-user] threaded ipython shell

Robert Cimrman cimrman3@ntc.zcu...
Mon May 11 03:02:56 CDT 2009


Hi Fernando,

thanks for responding!

Fernando Perez wrote:
> Hi Robert,
> 
> 2009/5/6 Robert Cimrman <cimrman3@ntc.zcu.cz>:
> No worries, I've been terrible at keeping up with public email due to
> a massive set of grant deadlines over the last few weeks, sorry about
> that.

It's sort of encouraging to hear that it is the same everywhere :)

>> ----

> This is pretty easy to do:
> 
> #!/usr/bin/env python
> """Simple customized ipython that specifically loads WX thread support"""
> 
> # Shell class options (the last one is plain, unthreaded ipython):
> # IPShellGTK, IPShellWX, IPShellQt, IPShellQt4, IPShell
> 
> from IPython.Shell import IPShellWX
> 
> # Main
> banner ="Welcome to the SFEPy IPython-based shell with Wx support!\n"
> 
> ipwx = IPShellWX()
> ipwx.mainloop(banner=banner)
> 
> 
> ### EOF
> 
> I hope this helps,

This works great thanks! (I can get several mayavi windows popping out 
now, all interactive.) However I still got a problem, maybe related to 
the ipython version I use (0.9.1).

I have already tried using the IPShellWX directly, before I posted the 
question, as:

###
def init_IPython():
     from IPython.Shell import IPShellWX
     return IPython.Shell.make_IPython(argv, shell_class=IPShellWX)

ip = init_Python()
ip.runcode(ip.compile("from sfepy.interactive import *"))
###

because I need to run the initialization code at startup - that code 
does some imports and sets up the environment so that the user has not 
to import anything by hand and just starts computing. It is the pattern 
I took from isympy. Then:

Traceback (most recent call last):
line 25, in init_IPython
     return IPython.Shell.make_IPython(argv, shell_class=IPShellWX)
   File "/usr/lib64/python2.5/site-packages/IPython/ipmaker.py", line 
103, in make_IPython
     embedded=embedded,**kw)
TypeError: __init__() got an unexpected keyword argument 'embedded'

Should the above work just like your script, or is it a wrong way of 
using IPShellWX?

thanks and cheers!
r.


More information about the IPython-user mailing list