[IPython-user] Exception embedding IPython - help please

brucedickey at micron.com brucedickey at micron.com
Fri Oct 14 16:13:57 CDT 2005


Alright, thank you. 

-----Original Message-----
From: Fernando Perez [mailto:Fernando.Perez at colorado.edu] 
Sent: Friday, October 14, 2005 3:11 PM
To: brucedickey
Cc: ipython-user at scipy.net
Subject: Re: [IPython-user] Exception embedding IPython - help please

brucedickey at micron.com wrote:
> Thanks, here is the traceback. Incidently, using red hat enterprise 3 
> -- had left that out
> 
> AttributeError: Prompt1 instance has no attribute 'split'
> 
> Traceback (innermost last):
> 
> File "/home/brucedickey/proj/diagnostic_framework_sdk/host_gui/diags.py", line 1, in ?
>   """
> File "/home/brucedickey/proj/diagnostic_framework_sdk/host_gui/diags.py", line 1296, in ?
>   app.MainLoop()
> File "/opt/sigsw/python/lib/python2.3/site-packages/wxPython/wx.py", line 1968, in MainLoop
>   wxPyApp.MainLoop(self)
> File "/opt/sigsw/python/lib/python2.3/site-packages/wxPython/wx.py", line 89, in MainLoop
>   val = wxc.wxPyApp_MainLoop(self, *_args, **_kwargs) File 
> "/home/brucedickey/proj/diagnostic_framework_sdk/host_gui/diags.py", line 181, in OnHelpBtn
>   ipshell("Here we go") # this call anywhere in your program 
> will start IPython File "/opt/sigsw/python/lib/python2.3/site-packages/IPython/Shell.py", line 199, in __call__
>   self.IP.embed_mainloop(banner,local_ns,global_ns,stack_depth=1)
> File "/opt/sigsw/python/lib/python2.3/site-packages/IPython/iplib.py", line 1337, in embed_mainloop
>   self.interact(header)
> File "/opt/sigsw/python/lib/python2.3/site-packages/IPython/iplib.py", line 1498, in interact
>   line = self.raw_input(prompt)
> File "/opt/sigsw/python/lib/python2.3/site-packages/IPython/iplib.py", line 1690, in raw_input
>   return self.prefilter(raw_input_original(prompt),
> File "/opt/sigsw/python/lib/python2.3/site-packages/wxPython/py/shell.py", line 772, in raw_input
>   self.write(prompt)
> File "/opt/sigsw/python/lib/python2.3/site-packages/wxPython/py/shell.py", line 699, in write
>   text = self.fixLineEndings(text)
> File "/opt/sigsw/python/lib/python2.3/site-packages/wxPython/py/shell.py", line 705, in fixLineEndings
>   lines = text.split('\r\n')

And as you can see, the innermmost three frames are all wxPython ones, not ipython ones.  This means that you are running into conflicts between the WX shell and ipython.  IPython and PyCrust are conflicting in some manner, because they both make a lot of assumptions about being in control of all interactive input.  Making them coexist, while desirable, is not a simple task and will likely require deep work on both sides.

If you want to embed ipython inside a WX app (like I said the Qt guys did), you'll likely need to do so inside an empty WX widget, NOT in a full PyCrust. 
  You can look at ipython's nbshell project for inspiration, which does run inside a WX widget.  But please note that this code is still 100% experimental (not even alpha), so use at your own risk.  It's not very documented at all yet, and requires a few low-level tricks to make it work.

http://projects.scipy.org/ipython/ipython/browser/nbshell/

Cheers,

f




More information about the IPython-user mailing list