Help on PyQt4 QProcess

Edgar Fuentes fuentesej at gmail.com
Fri Aug 19 19:15:20 CEST 2011


Dear friends,

I need execute an external program from a gui using PyQt4, to avoid
that hang the main thread, i must connect the signal "finished(int)"
of a QProcess to work properly.

for example, why this program don't work?

   from PyQt4.QtCore import QProcess
   pro = QProcess() # create QProcess object
   pro.connect(pro, SIGNAL('started()'), lambda
x="started":print(x))        # connect
   pro.connect(pro, SIGNAL("finished(int)"), lambda
x="finished":print(x))
   pro.start('python',['hello.py'])        # star hello.py program
(contain print("hello world!"))
   timeout = -1
   pro.waitForFinished(timeout)
   print(pro.readAllStandardOutput().data())

output:

   started
   0
   b'hello world!\n'

see that not emit the signal finished(int)

I'm using Python 3.2 and PyQt 4.8.4 under winxp 32bit.


best regards,



More information about the Python-list mailing list