[BangPypers] "continue" in "try..except"

Noufal Ibrahim noufal at gmail.com
Mon Nov 21 12:02:18 CET 2011


<Nikunj.Badjatya at emc.com> writes:

> Hey Philippe, Thanks exactly what I wanted.  My main() is calling
> other scripts written in powershell(.PS1) using subprocess.call().
> Will this mechanism work in that case also ? I mean will this resume
> the execution from the same place where it left off as desired ?

I didn't know this was on Windows and I'm don't know enough to
answer. 

On UNIX, sending a signal using C-c will send it to all processes
associated terminal (using kill will send it only to the requested
PID). This means that if you're running a shell pipeline using
subprocess.call, it will receive a SIGINT too and has to handle that
differently. In essence, the pausing and resuming has to be done in that
program since it is the thing that knows the state of installation.

I'm not totally sure if this is the situation on Windows although modern
ones are POSIX compliant. 

Generally speaking, cross process work with duct tape/glue programs are
a source of trouble. I would recommend that you either port your PS
program to Python to keep it in process or do the whole thing in
Python. 

You *might* be able to send a STOP signal to the subprocess if your
Python program receives an INT to make it halt but then freeing
resources etc. after that will be a pain. 

[...]


-- 
~noufal
http://nibrahim.net.in

Some bachelors want a meaningful overnight relationship.


More information about the BangPypers mailing list