[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QThread terminate trouble when porting to Python 3
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2012-09-24 11:49:54
Message-ID: 6a1cd692c674bba86bd277ca692d86ea () localhost
[Download RAW message or body]

On Sat, 22 Sep 2012 22:25:24 +0430, Lee Harr <missive@hotmail.com> wrote:
> I created a simple test case to demonstrate the problem I am having.
> 
> As it is, running in Python 3.2 with PyQt 4.9.1 on Ubuntu, the program
> freezes when trying to terminate the QThread.
> 
> With the sleep, or if running on Python 2.7 with PyQt 4.9.1 the
> thread will terminate and the main thread will exit normally.
> 
> (To run with Python 2, switch to Python 2 print statement. Also
> works successfully with print as a function in Python 2.)
> 
> Can this be considered a bug? In what? Python, PyQt or Qt? Or
> does this fall under the "do not attempt to terminate a QThread"
> warning?
> 
> Thanks for any help.
> 
> 
> # test_qthread.py
> 
> #from __future__ import print_function
> 
> import time
> from PyQt4 import QtCore
> 
> 
> class CmdThread(QtCore.QThread):
>     def run(self):
>         while True:
>             #print 'test'
>             print('test')
>             #time.sleep(0.2)
> 
> 
> if __name__ == '__main__':
>     t = CmdThread()
>     print('thread set up')
>     t.start()
>     print('thread started')
>     time.sleep(1)
>     print('terminating thread')
>     t.terminate()
>     print('terminated')
>     time.sleep(1)
>     print('thread is running:', t.isRunning())

For me it fails in the same way with Python 2.7 and 3.3. I don't see this
as a bug in either Python, Qt or PyQt.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic