Multiple thread program problem
Cameron Simpson
cs at zip.com.au
Thu Jun 4 18:58:00 EDT 2015
On 04Jun2015 10:20, M2 <mohan.mohta at gmail.com> wrote:
>Awesome Cameron.
>It works the way I want it to work.
Glad to hear it. A few small remarks:
>Thanks a lot guys.
>Here is the new code:
[...]
>from thread import start_new_thread
You're not using this any more. You may want to tidy this up.
>def proc(col) :
> P=subprocess.Popen(col, shell=True)
> return
You are not returning P. But ...
> co=str("ssh -B ")+ str(com2) + str(com3)
> P=proc(co)
Here you are saving the return value as P (local to this function). My
suggestion, I know. The point here is that in later code you might save all the
P values and call P.wait() for them at some point after the loop, waiting for
them to terminate. Or you may not care. Your call.
>f.close()
Consider adding the suggested "with" form. Shorter, easier to read, more
reliable.
Cheers,
Cameron Simpson <cs at zip.com.au>
Ride fast
Die fast
Leave no usable organs
- Tom Warner <tom at dfind.demon.co.uk>
More information about the Python-list
mailing list