Re: Multiple thread program problem

2015-06-04 Thread Cameron Simpson
On 04Jun2015 10:20, M2 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) :

Re: Multiple thread program problem

2015-06-04 Thread M2
On Wednesday, June 3, 2015 at 3:41:15 PM UTC-5, M2 wrote: > Hello > I am trying to create multiple thread through the below program but I am > getting an error > > #! /usr/bin/python > import os > import subprocess > import thread > import threading > from thread import start_new_thread > > def

Multiple thread program problem

2015-06-04 Thread Sam Raker
proc(f) isn't a callable, it's whatever it returns. IIRC, you need to do something like 'start_new_thread(proc, (f,))' -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiple thread program problem

2015-06-04 Thread Gary Herron
On 06/03/2015 01:41 PM, Mohan Mohta wrote: Hello I am trying to create multiple thread through the below program but I am getting an error #! /usr/bin/python import os import subprocess import thread import threading from thread import start_new_thread def proc(f) : com1="ssh -B "

Re: Multiple thread program problem

2015-06-03 Thread Cameron Simpson
On 03Jun2015 19:59, M2 wrote: On Wednesday, June 3, 2015 at 7:38:22 PM UTC-5, Cameron Simpson wrote: I would be passing only "line" to proc, not "f" at all. Suggestion: move your main code into its own function. That will make all the variables in it "local". Your proc function is presently re

Re: Multiple thread program problem

2015-06-03 Thread M2
On Wednesday, June 3, 2015 at 7:38:22 PM UTC-5, Cameron Simpson wrote: > On 03Jun2015 17:04, M2 wrote: > >On Wednesday, June 3, 2015 at 6:56:47 PM UTC-5, sohca...@gmail.com wrote: > >> On Wednesday, June 3, 2015 at 4:45:52 PM UTC-7, M2 wrote: > >> > On Wednesday, June 3, 2015 at 5:34:31 PM UTC-5,

Re: Multiple thread program problem

2015-06-03 Thread Cameron Simpson
On 03Jun2015 17:04, M2 wrote: On Wednesday, June 3, 2015 at 6:56:47 PM UTC-5, sohca...@gmail.com wrote: On Wednesday, June 3, 2015 at 4:45:52 PM UTC-7, M2 wrote: > On Wednesday, June 3, 2015 at 5:34:31 PM UTC-5, Waffle wrote: > > You think "(f)" makes a tuple, but it does not. > > the parentesi

Re: Multiple thread program problem

2015-06-03 Thread M2
On Wednesday, June 3, 2015 at 6:56:47 PM UTC-5, sohca...@gmail.com wrote: > On Wednesday, June 3, 2015 at 4:45:52 PM UTC-7, M2 wrote: > > On Wednesday, June 3, 2015 at 5:34:31 PM UTC-5, Waffle wrote: > > > You think "(f)" makes a tuple, but it does not. > > > the parentesis is not the tuple constru

Re: Multiple thread program problem

2015-06-03 Thread sohcahtoa82
On Wednesday, June 3, 2015 at 4:45:52 PM UTC-7, M2 wrote: > On Wednesday, June 3, 2015 at 5:34:31 PM UTC-5, Waffle wrote: > > You think "(f)" makes a tuple, but it does not. > > the parentesis is not the tuple constructor, the comma is > > try: > > t=thread.start_new_thread(proc,(f,)) > > Thanks f

Re: Multiple thread program problem

2015-06-03 Thread Mohan Mohta
On Wednesday, June 3, 2015 at 5:34:31 PM UTC-5, Waffle wrote: > You think "(f)" makes a tuple, but it does not. > the parentesis is not the tuple constructor, the comma is > try: > t=thread.start_new_thread(proc,(f,)) Thanks for the pointer waffle. The program executes now but still not the way I

Re: Multiple thread program problem

2015-06-03 Thread Joonas Liik
You think "(f)" makes a tuple, but it does not. the parentesis is not the tuple constructor, the comma is try: t=thread.start_new_thread(proc,(f,)) -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiple thread program problem

2015-06-03 Thread Mohan Mohta
On Wednesday, June 3, 2015 at 4:01:13 PM UTC-5, Sam Raker wrote: > proc(f) isn't a callable, it's whatever it returns. IIRC, you need to do > something like 'start_new_thread(proc, (f,))' If I execute something like t=thread.start_new_thread(proc,(f)) I get: Traceback (most recent call last):

Re: Multiple thread program problem

2015-06-03 Thread MRAB
On 2015-06-03 21:41, Mohan Mohta wrote: Hello I am trying to create multiple thread through the below program but I am getting an error #! /usr/bin/python import os import subprocess import thread import threading from thread import start_new_thread def proc(f) : com1="ssh -B "

Multiple thread program problem

2015-06-03 Thread Mohan Mohta
Hello I am trying to create multiple thread through the below program but I am getting an error #! /usr/bin/python import os import subprocess import thread import threading from thread import start_new_thread def proc(f) : com1="ssh -B " com2=line.strip('\n') com3= " un