Prevent Python kernal from crashing when running an application in QT

1.3k views Asked by At

I am attempting to write a program using PysideQT using Spyder. While the application runs fine from command line, the program causes the Python's Kernel to crash when running from Spyder's interpretive Python kernel. I cannot figure out what is causing the issue. I am running Ubuntu LTS 14.04 on a 64bit system. Once again, this issue does not occur when I run the program from terminal.

I have written the following program that causes the Kernel to crash:

import sys
import PySide.QtGui as qg
app = qg.QApplication(sys.argv)

Here is a dump from the console output:

It seems the kernel died unexpectedly. Use 'Restart kernel' to continue using this console.
It seems the kernel died unexpectedly. Use 'Restart kernel' to continue using this console.
It seems the kernel died unexpectedly. Use 'Restart kernel' to continue using this console.

Any help would be appreciated.

1

There are 1 answers

0
Skylion On BEST ANSWER

I found an solution. Essentially, you can't use sys.argv from Spyder because the way Spyder launches the program it's undefined. You can manually setup Spyder to specify it or you can just replace sys.argv with the file name, in my case fileloader.py.