I tried using QThread as well.. But the problem is, on the run method when i invoke the command prompt, it sends out the finished signal... I want it to send out the finished signal only on closing the command prompt that is invoked earlier in my process.
guess some logic to be implement inside run() which monitors the command prompt / reports the status once the command prompt is closed. I tried running loop inside the run() to keep the thread active but no help.. class RunMonitor(QThread): def __init__(self, parent = None): QThread.__init__(self) def run(self): print 'Invoking command prompt...............' subprocess.call(["start", "/DC:\\PerfLocal_PAL", "scripts_to_execute.bat"], shell=True) while True: pass def runscript(self): print 'Complete_file_Path inside Run script is : ' , self.complete_file_path file_operation.Generate_Bat_File(self.complete_file_path) self.run_monitor_object = RunMonitor() self.run_monitor_object.start() self.connect(self.run_monitor_object, SIGNAL("finished()"),self.threadstatus) On Wed, May 11, 2011 at 9:25 PM, Wojtek Mamrak <tacyt1...@gmail.com> wrote: > 2011/5/11 Chris Angelico <ros...@gmail.com>: > > On Thu, May 12, 2011 at 1:16 AM, Wojtek Mamrak <tacyt1...@gmail.com> > wrote: > >> Is there any special reason you don't want to use QThread? > >> > http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qthread.html#details > > > > Other than that QThread is part of QT and threading isn't, what are > > the advantages of QThread? Is it possible (safe) to manipulate QT > > objects - in this case, the button - from a thread other than the one > > that created them? (If not, that would be a good reason for using > > QThread, which will fire an event upon termination.) > > > > > QThread provides mechanism of signals and slots ("from" and "to" the > thread), which are used across all pyQt. Unfortunately it is not > possible to use any widget classes in the thread (direct quote from > the docs). On the other hand signals can fire methods from the main > thread (running the app'a main loop), so this is not a big deal. > The signals are: > - finished > - started > - terminated > It is possible to block the thread, make it sleep, check whether the > thread is running, and few others. > -- > http://mail.python.org/mailman/listinfo/python-list > -- Vijay Swaminathan
-- http://mail.python.org/mailman/listinfo/python-list