Qt Application Crash when calling app.quit() in PyTango 9.2.0 (it works with PyTango 8.1.6)

Hi Tangoers,
We try to migrate from PyTango 8.1.6 to 9.2 for our Windows clients.
As we did'nt manage yet to compile PyTango 9.2.3, I use a msi installer for PyTango9.2.0.
We use Python 2.7 32b.

With PyTango9.2.0 within a Qt Application,
if I subscribe to an attribute using pyds.subscribe_event
then Python crashed when I call :
app = QtGui.QApplication(sys.argv)
app.quit()

The same code works with PyTango 8.1.3.
An example is attached.

If somebody could tell me if it works on Windows with PyTango 9.2.3, it would motive us to compile !
launch:
- DeclareDS
- TestDevice
- Client
- Push OK


If you have a workaround …
Cheers,
Christophe

sample code for the client :
class EventManager():
    
    def __init__(self,deviceAdr, attrAdr,fct,app):
        #Subscribe to the counter
        self.pyds = PyTango.DeviceProxy(deviceAdr)
        self.id_event = self.pyds.subscribe_event(attrAdr, PyTango.EventType.CHANGE_EVENT, self.ReceiveTangoEvent, stateless = True)
        self.app = app
        
        self.wd = QtGui.QLabel("TEST")
        self.wd.show()
        
        #The QUIT button close the application
        self.wdButton = QtGui.QPushButton("QUIT")
        self.wdButton.clicked.connect(self.stop)
        self.wdButton.show()

        #Create a Signal to display the Tango Value
        QtCore.QObject.connect(Qt.qApp, QtCore.SIGNAL("updateData(PyQt_PyObject)"),self.UpdateGui)
        
    def ReceiveTangoEvent(self,event):
        print str(event.attr_value.value)
        Qt.qApp.emit(QtCore.SIGNAL("updateData(PyQt_PyObject)"),str(event.attr_value.value))        

    def UpdateGui(self,data):
        self.wd.setText(data)

    #Called by the QUIT button (OK in PyTango 8.1.6, CRASH in PyTango 9.2.0)
    def stop(self):        
        QtCore.QObject.disconnect(Qt.qApp, QtCore.SIGNAL("updateData(PyQt_PyObject)"),self.UpdateGui)
        self.pyds.unsubscribe_event(self.id_event) 
        self.app.quit()

        
if __name__ == "__main__": # pragma: no cover

    app = QtGui.QApplication(sys.argv)

    #The server push a counter
    ev1 = EventManager("test/TestDevice/TestDevice","trignumber",test1,app)
    
    sys.exit(app.exec_())



Edited 5 days ago
a simpler example attached.
code for the client is below :

@author: cchappet
'''
import sys,os
import time

from PyQt4 import QtCore
from PyQt4 import Qt,QtGui

import PyTango

class EventManager():
    
    def __init__(self,deviceAdr, attrAdr,app):
        #Subscribe to the counter
        self.pyds = PyTango.DeviceProxy(deviceAdr)
        self.id_event = self.pyds.subscribe_event(attrAdr, PyTango.EventType.CHANGE_EVENT, self.ReceiveTangoEvent, stateless = True)
        self.app = app
        
        #The QUIT button close the application
        self.wdButton = QtGui.QPushButton("QUIT")
        self.wdButton.clicked.connect(self.stop)
        self.wdButton.show()
        
    def ReceiveTangoEvent(self,event):
        print str(event.attr_value.value)

    #Called by the QUIT button (OK in PyTango 8.1.6, CRASH in PyTango 9.2.0)
    def stop(self):        
        self.pyds.unsubscribe_event(self.id_event) 
        self.app.quit()

        
if __name__ == "__main__": # pragma: no cover

    app = QtGui.QApplication(sys.argv)

    #The server push a counter
    ev1 = EventManager("test/TestDevice/TestDevice","trignumber",app)
    
    sys.exit(app.exec_())  
Edited 5 days ago
Hi Christophe,

you could check to see if the issue is solved in PyTango 9.2.3 using the pre-compiled binaries for Windows which are part of the continuous integration system on AppVeyor. Take a look at the slides 9 to 19 in this presentation:

https://indico.eli-beams.eu/event/310/session/15/contribution/52/material/slides/1.pdf

Maybe 9.2.3 solves your problem …

Cheers

Andy
Oops I was too quick. My suggestion to try out the AppVeyor Windows builds will only upgrade the Tango libraries and not PyTango.

Maybe Sebastien can help you get access to PyTango AppVeyor builds.

Sorry about raising false hopes …

Andy
Hi Christophe,

Although I don't have a Windows version of PyTango 9.2.3, I've tested your code (the 2nd client version) on the linux version of PyTango 9.2.2 and it works as expected. Perhaps you could download the Windows version 9.2.2 and try it.

Regards,
Geoff.
Hi christophe,

I cannot reproduce your problem with 9.2.2 on linux neither.

Could you send the error message?

I recommend you try with 9.2.2.

I don't see anything in the PyTango changelog that indicates your problem might be solved but since PyTango is statically linked with the tango C++ library on Windows, if you update PyTango, automatically you use the new Tango C++. So even if the problem is coming from the C++ layer, updating should make the problem disappear.

Hope it helps
Tiago
Edited 4 days ago
Hi Tiago and Geoff,
There is no error message, just a "python.exe stopped working".
Do you know if there is an installer (msi, exe) for PyTango 9.2.2 on Windows because we didn't manage to recompile.
Christophe
Edited yesterday at 08h45
Hi Cristophe,

can you try this installer ?

https://ci.appveyor.com/api/buildjobs/djvtxrv064gr0ipj/artifacts/pytango-9.2.3.Win32-py2.7.msi

or the exe file
https://ci.appveyor.com/api/buildjobs/djvtxrv064gr0ipj/artifacts/pytango-9.2.3.Win32-py2.7.exe

thanks
Thanks Sébastien, the msi is working fine.
I still get a crash but with an error message :
Assertion failed: Successful WSASTARTUP not yet performed (..\..\..\src\signaler.cpp:377)

Hi, could it be related to ZMQ socket/context management?

https://stackoverflow.com/questions/19795245/zeromq-context-singleton-provided-in-a-dll-crashes-when-program-exits-vs2010
 
Register or login to create to post a reply.