[IPython-User] modify a running script
Fri Sep 23 12:16:09 CDT 2011
> On Thu, Sep 22, 2011 at 10:38 AM, Piotr Zolnierczuk
> <firstname.lastname@example.org> wrote:
> > Hi,
> > I came across this an interesting new use case.
> > A user wants to run a (long running experiment control) script and pause
> > at some point, modify something (e.g. a variable) and continue the
> > execution.
> > My answer was to use pdb from within ipython. Is there (out there)
> > else that could be used for this?
> You can try and except KeyboardInterrupt, or register a signal handler
> for it as demoed here:
> import signal
> import sys
> def signal_handler(signal, frame):
> print 'you can embed some logic here when user pressed Ctrl+C!'
> signal.signal(signal.SIGINT, signal_handler)
> print 'Press Ctrl+C'
> while True:
> Paul Ivanov
> 314 address only used for lists, off-list direct email at:
> http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
> That's an interesting piece of code. I did not know that Python supports
signals (just like in the old Unix days and C). And it even works on an old
XP box. I am going to use this for something for sure!
That does not solve the 'modify and continue' problem, does it?
But will keep playing.
Piotr Adam Zolnierczuk
written on recycled electrons
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User