PyQT crashes after sleep

2

I use python3.5.2 and PyQt4.

Im using PyQt to connect and use .ocx.

from PyQt4.QAxContainer import QAxWidget
    if __name__ == "__main__":
        app = QApplication(sys.argv)
        while True:
            # run some codes that use QAxWidget.dynamicCall() function
            # print some results
            sleep(30)

After sleep and going back to main code, i got "Process finished with exit code -1073740771 (0xC000041D)"

I tried to use try... except... clause, but could not catch error.

What problems should I speculate?

How can I debug?

EDIT:

crash report:

program name: python.exe, version: 3.5.1150.1013, timestamp: 0x576eff6a

module name: QAxContainer.pyd, version: 0.0.0.0, timestamp: 0x56123368

exception code: 0xc000041d

error offset: 0x00013301

process ID: 0x4d24

EDIT2:

If I set the sleep(30) to sleep(10), it works correctly without any crash.

python
pyqt
pyqt4
python-3.5
asked on Stack Overflow Nov 7, 2016 by SounBum Song • edited Nov 7, 2016 by SounBum Song

1 Answer

0

I can be the garbage collector that dispose your app.
So try putting the app global.

Try in this way:

from PyQt4.QAxContainer import QAxWidget
app = None

if __name__ == "__main__":
    app = QApplication(sys.argv)
    while True:
        # run some codes that use QAxWidget.dynamicCall() function
        # print some results
        sleep(30)
answered on Stack Overflow Sep 19, 2018 by Davide Pizzolato

User contributions licensed under CC BY-SA 3.0