[PyQt] QThread problem

Sergio Jovani lesergi at gmail.com
Mon Dec 8 18:52:22 GMT 2008


El Monday 08 December 2008 17:19:42 vàreu escriure:
> Hello,
>
> Sergio Jovani wrote
>
> > class Download(QThread):
> > 	def __init__(self, url, path, filename, parent = None):
> > 		QThread.__init__(self, parent)
> > 		self.path=path
> > 		self.url=url
> > 		self.filename=filename
> >
> > 	def run(self):
> > 		os.chdir(self.path)
> > 		urllib.urlretrieve(self.url,self.filename,reporthook=self.myreporthook)
>
> I don't know if this would be the problem, because it looks like you
> have trimmed the code to only contain relevant parts.  I have a couple
> questions.  If you don't terminate, does it properly retrieve the item
> at the url?
>
> Your code here for the Download class has no definition of
> "self.myreporthook" so could that be the problem?
>
> darryl


Hi,

When I remove wait() after terminate(), application does not freeze and 
download seems to be cancelled, file isn't retrieved, but I get True from 
isRunning() execution, it seems thread has not terminated.

self.myreporthook is not important, if I remove it, thread works equal.

Thanks!



More information about the PyQt mailing list