This question already has an answer here:
I'm getting an error about an operation involving a QPyNullVariant:
TypeError: unsupported operand type(s) for *: 'QPyNullVariant' and 'float'
I wanted to put a check into my code to skip these values. However, my IDE (Eclipse) [and more over the terminal Python interface] doesn't recognize this as part of the PyQt4.QtCore module whereas it seems fine within QGIS. I have updated all my packages and restarted my computer.
import PyQt4.QtCore as pyqt import sys print(sys.version) #1 print(pyqt.__file__) #2 pyqt.QPyNullVariant #3
in all cases this produces the following out put for 1 and 2:
2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so
However in Eclipse (with PyDev) and in the terminal interpreter the call to PyQt module for a QPyNullVariant attribute fails:
AttributeError: 'module' object has no attribute 'QPyNullVariant'
whereas in the QGIS python interpreter you get: