[IPython-user] implementing non-blocking thread execution for something other than toolkits

Rohan Nicholls rohan.nicholls@googlemail....
Wed Feb 25 04:56:20 CST 2009

Sorry I was not very specific there.

At the moment I am working with web.py.  If I do a:

run <scriptname> <portnum>

I get the output in the ipython window, but control is taken over by
the web.py process, and I lose the interactivity of the prompt.

All I would like to do is be able to run the script in the same way I
would run it using the -wthread flag, so it runs, I see output, but I
also have access to the prompt and the instance is bound to app, so I
can query the environment while it is running.

This has become crucial at the moment because the application is
hooking into another set of libraries and something very strange is
going on with the globals() variable, and I have no way of asking it
its value at various events being triggered in the script (i.e. a
request coming into the server).

web.py essentially runs as a cgi script, if that is any help.

I hope this describes what I am looking for.  I am actually looking
for a generic way to do this, so it would work just as well with
something like pylons etc. but for now web.py is my puzzle as it tries
to avoid a lot of magic.

Thanks for your response,


On Wed, Feb 25, 2009 at 10:57 AM, Ville M. Vainio <vivainio@gmail.com> wrote:
> On Wed, Feb 25, 2009 at 11:49 AM, Rohan Nicholls
> <rohan.nicholls@googlemail.com> wrote:
>> I have been using ipython's support of -wthread to great effect.
>> Another area where this sort of non-blocking thread execution would be
>> very handy is with web servers.
> The whole point for -wthread and the likes is that ipython code needs
> to be run in the main loop of gui thread (which is different from the
> thread that runs the "shell loop" that does raw_input.
> If you have your own blacking web serving code and want to run ipython
> alongside it, you probably don't need such a hack - you can just run
> ipython in its own thread & be happy.
> So do you have a specific example of what you want to do?
> --
> Ville M. Vainio
> http://tinyurl.com/vainio

More information about the IPython-user mailing list