X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109 Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!nospam.fr.eu.org!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'skip:p 40': 0.04; 'thread,': 0.04; 'properly.': 0.09; 'slot': 0.09; 'gui': 0.13; '"0"': 0.16; 'lambda': 0.16; 'received:openhosting.com': 0.16; 'received:user.openhosting.com': 0.16; 'timeout': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.16; 'subject:Help': 0.17; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; '-0700': 0.23; 'aug': 0.24; 'code': 0.25; 'skip:p 30': 0.28; 'import': 0.28; 'cc:addr:python.org': 0.30; 'header:User-Agent:1': 0.34; 'external': 0.35; 'object': 0.35; 'fri,': 0.36; 'skip:" 10': 0.36; 'example,': 0.37; 'using': 0.37; 'signal': 0.38; 'subject:: ': 0.39; 'why': 0.39; 'your': 0.61; 'dear': 0.63; 'pro': 0.89 X-Virus-Scanned: Debian amavisd-new at rvrbank1.user.openhosting.com MIME-Version: 1.0 Date: Fri, 19 Aug 2011 18:56:30 +0100 From: Phil Thompson To: Edgar Fuentes Subject: Re: Help on PyQt4 QProcess Organization: Riverbank Computing Limited In-Reply-To: <54614b21-2c80-444c-8ac5-89fc52b77121@fv14g2000vbb.googlegroups.com> References: <54614b21-2c80-444c-8ac5-89fc52b77121@fv14g2000vbb.googlegroups.com> X-Sender: phil@riverbankcomputing.com User-Agent: RoundCube Webmail/0.3.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313777088 news.xs4all.nl 23856 [2001:888:2000:d::a6]:51266 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11862 On Fri, 19 Aug 2011 10:15:20 -0700 (PDT), Edgar Fuentes 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