Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11862
| Date | 2011-08-19 18:56 +0100 |
|---|---|
| From | Phil Thompson <phil@riverbankcomputing.com> |
| Subject | Re: Help on PyQt4 QProcess |
| Organization | Riverbank Computing Limited |
| References | <54614b21-2c80-444c-8ac5-89fc52b77121@fv14g2000vbb.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.229.1313777088.27778.python-list@python.org> (permalink) |
On Fri, 19 Aug 2011 10:15:20 -0700 (PDT), Edgar Fuentes
<fuentesej@gmail.com> wrote:
> 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)
Yes it is, and your lambda slot is printing "0" which is the return code
of the process.
Phil
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help on PyQt4 QProcess Edgar Fuentes <fuentesej@gmail.com> - 2011-08-19 10:15 -0700
Re: Help on PyQt4 QProcess Phil Thompson <phil@riverbankcomputing.com> - 2011-08-19 18:56 +0100
Re: Help on PyQt4 QProcess Edgar Fuentes <fuentesej@gmail.com> - 2011-08-19 12:55 -0700
Re: Help on PyQt4 QProcess Carl Banks <pavlovevidence@gmail.com> - 2011-08-19 13:21 -0700
Re: Help on PyQt4 QProcess Edgar Fuentes <fuentesej@gmail.com> - 2011-08-19 14:32 -0700
Re: Help on PyQt4 QProcess Phil Thompson <phil@riverbankcomputing.com> - 2011-08-20 09:36 +0100
Re: Help on PyQt4 QProcess Edgar Fuentes <fuentesej@gmail.com> - 2011-08-22 10:43 -0700
csiph-web