[IPython-user] exiting ipshell()

Kumar Golap tizan.moris at gmail.com
Tue Oct 3 13:51:36 CDT 2006


Hi Fernando,

I'm launching the fork in a script launched from within the
ipshell()...so basically i want to do what you propose from withing
the ipython shell...

The snippet of code below is part of a python function that a user
will be running inside ipython.


Thanks for your help

Kumar

	pid= os.fork()
	if pid:
		#we are the parent : go back to cursor in  ipython shell
		return
	else:
		#we are the child..
                # Can i exit the ipshell at this stage ?
		im.open(vis)	
		im.do_plenty_processing()
		sys.exit(0)



On 10/3/06, Fernando Perez <fperez.net at gmail.com> wrote:
> On 10/3/06, Kumar Golap <tizan.moris at gmail.com> wrote:
> > Hi All,
> >
> > I was wondering if its possible to exit the ipythonshell without
> > exiting python. (or may be just turn off interactivity totally).
> >
> > The reason is to allow users of a function to fork the process (using
> > os.fork())....and in the child process i want just to execute some cpu
> > intensive stuff without any interactivty....
> >
> > Right now when i fork and return back to the prompt in the parent
> > process...some of the character that i type on the shell seems to be
> > grabbed by the child process  (this does not seem to happen in pure
> > python...hence my guess its related to the ipython shell). And i do
> > want to stay in the ipython shell in the parent process.
> >
> >
> > Thanks for any help/suggestions
>
> Do the set_dummy calls described here:
>
> http://ipython.scipy.org/doc/manual/node9.html
>
> do what you need?  I'm not sure if the stdin capture issues you're
> seeing will be solved by this, but calling
>
> ipshell.set_dummy_mode(True)
>
> will make all subsequent calls to
>
> ipshell()
>
> just return silently.
>
> Cheers,
>
> f
>


More information about the IPython-user mailing list