I am a newbie with python and today I have tried to set the Spyder IDE to run PySide clases in order to make some applications. The thing is, once Spyder was installed (Spyder (Python 2.7) in Ubuntu) I tried to launch a hello world in order to check if all was correctly tied up. Before installing Spyder I had Python 2.7 with the PySide packages properly intalled. This is what my PySide Hello World program look like:
import sys
from PySide.QtCore import *
from PySide.QtGui import *
# Create a Qt application
app = QApplication(sys.argv)
# Create a Label and show it
label = QLabel("Hello World")
label.show()
# Enter Qt application main loop
app.exec_()
sys.exit()
When I tried to run the code pushing the Run File button (F5) the console only shows
runfile('/home/leo/.spyder2/temp.py', wdir='/home/leo/.spyder2')
And the same thing selectig a IPython console throws
runfile('/home/leo/.spyder2/temp.py', wdir='/home/leo/.spyder2') 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. ...etc...
But nothing happens, no application launched. However, if I select the whole text in the code editor, and then press F9 (which only executes the selected lines) everything works fine and the test application pops up!!! This happens with both Console and IPython Console. I looked for some explanation about this awkward behaviour on the internet (like this post spider IDE python. Difference in running by pressing F5 and F9?) but in the end my question ends unanswered... One more thing, executing the code in IPython console succesfully launches the test application, but once it is closed, a second attempt in the same console throws en error
RuntimeError: A QApplication instance already exists.
Any help would be very appreciated, thank you community.