[IPython-dev] Need help from Ipython guru...

Laurent Dufrechou Laurent.Dufrechou@free...
Wed Dec 5 07:51:25 CST 2007


Hi IPythoners,

I’m trying to do a litttle wx widget for ipyton.(I’ve posted some version on
the list last day)
Currently all is working quite well, but I’m stuck to a bug that I can’t
handle.
If I write:
“import smtplib”
“smtplib.re?”
Then ipython shell call the ? magic function and because the text is too
long, it is stuck to a getch inside genutils…
 >Term.cout.write('---Return to continue, q to quit--- ')
 > ans = msvcrt.getch()

Too bad I can’t do anything.
Is there a way to say to ipython:
“Hey guy! Give me the full text I will split it by myself and please don’t
ask me to push a key!”
Perhaps there is a secret var to set the line before breaking text?
Or pehaps I couls define my pager? But then how to say to ipython, that my
pager is this one...?
I've seen that previous guy set os.environ['TERM'] = 'dumb' if this the
reason why dump_pager is called?


Other question:
When i go back in history, previous '?' key appears like this:
ex: smtplib?
appears as: "#?smtplib"
Is the # ok? if yes, is there any reason why the history return that?
(to get history I do: rv =
self.IP.user_ns['In'][self.history_level].strip('\n'))

Another question for gurus:
Currently to embbed the Ipython shell, I’ve reused the code from gtk Ipython
widget guy:
“
self.term = IPython.genutils.IOTerm(cin=cin, cout=cout, cerr=cerr)
os.environ['TERM'] = 'dumb'
 excepthook = sys.excepthook 
 self.IP = IPython.Shell.make_IPython(
      argv,user_ns=user_ns,
      user_global_ns=user_global_ns,
      embedded=True,
      shell_class=IPython.Shell.InteractiveShell)
 self.IP.system = lambda cmd: self.shell(self.IP.var_expand(cmd),
                                            header='IPython system call: ',
                                           
verbose=self.IP.rc.system_verbose) “

Is this the best way to embed ipython nowadays.
I mean I’ve seen that there is some classes:
IPShellEmbed for example.
Currently the design of the widget is limited by the fact that the ipython
shell is not in a different process or thread, so if it locks, it locks all
the app…
Is there a best way to do embed an ipython shell then my current way?

Cheers,
Laurent

-- 
View this message in context: http://www.nabble.com/Need-help-from-Ipython-guru...-tf4949781.html#a14171949
Sent from the IPython - Development mailing list archive at Nabble.com.



More information about the IPython-dev mailing list