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:

[GCC 4.8.2]


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:

<class 'PyQt4.QtCore.QPyNullVariant'>


marked as duplicate by Germán Carrillo, PolyGeo Jul 13 '16 at 4:35


  • Further debugging and a try/except show that it evaluates as equal to None which is good for a simple test, but... I'm still puzzled. – Kris Jan 14 '16 at 16:12