[IPython-User] non-interactive use of ipython qt console

Ruben Lysens rlysens@broadcom....
Fri Nov 4 11:02:07 CDT 2011


Hi all,

I have a python program that collects data from a socket and prints it to the console. I'd like to take advantage of ipython qtconsole's -pylab=inline features, i.e. I'd like the program to graph data instead of just printing it.
I start the program as follows: ipython qtconsole -pylab=inline --IPKernelApp.file_to_run=logView.py
However, in order to make that work, I've had to run the program as a background thread:

if __name__ == '__main__':
    lvi = LogViewImp()
    def threadFun():
        lvi.go() #reads from socket, prints to console
    thread.start_new_thread(threadFun,())

If try to run it in the foreground, the program won't run and I get this on my Command Prompt:
...
QCoreApplication::exec: The event loop is already running
QCoreApplication::exec: The event loop is already running
QCoreApplication::exec: The event loop is already running
...

I'm guessing that IPKernelApp.file_to_run executes before the ipython qtconsole has completely booted up, which is why starting the program as a background thread works.
But that's just a guess.

So, what's the correct way to do this? How do I run the program in the foreground (I don't want an active prompt in my console). Is there another hook into ipython qtconsole that I can use?

I'm running IPython 0.11 on Windows XP.

Thanks,

Ruben.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20111104/54d37d4d/attachment.html 


More information about the IPython-User mailing list