2

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:

<class 'PyQt4.QtCore.QPyNullVariant'>

Thoughts?

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 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