1

In my Python 2.7.3 application, using PySide 1.1.2 and Qt 4.8.4, I do the following:

from PySide import QtGui
app = QtGui.QApplication(sys.argv)

The code is working fine, with some more commands afterwards the Qt window is correctly created. However, in Eclipse/PyDev QApplication is underlined red and the mouse over popup says

Undefined variable from import: QApplication

Is there any way to fix this in Eclipse/PyDev?

Matthias
  • 9,817
  • 14
  • 66
  • 125
  • Try going to window>preferences>interpreter - python>forced Builtins(tab)> click the new button on that tab and add PySide – Yoriz Apr 21 '13 at 00:08
  • I have to ask. Did you try to restart Eclipse/PyDev? When I was using it for Java I had to do that every now and then when it refused to update the error marker(s). – timss Apr 21 '13 at 00:08
  • Great, thank you very much. After adding `PySide` to the forced builtins and restarting Eclipse the problem is solved. – Matthias Apr 21 '13 at 00:15

1 Answers1

5

Go to window>preferences>interpreter - python>forced Builtins(tab)> click the new button on that tab and add PySide

Yoriz
  • 3,595
  • 2
  • 13
  • 20
  • Didn't work for me. LiClipse still shows the "Undefined variable from import for QApplication and QWidgets. – Nav Jul 26 '19 at 10:13