PyQtGraph tries to put TensorFlow stuff onto a QGraphicsScene() on cleanup

372 views Asked by At
from PyQt4 import QtGui
import tensorflow as tf
import pyqtgraph as pg


app = QtGui.QApplication([])
wnd = QtGui.QWidget()
wnd.show()
app.exec_()

File "/home/serj/cycle_ml/venv/local/lib/python3.4/site-packages/pyqtgraph/__init__.py", line 312, in cleanup
    if isinstance(o, QtGui.QGraphicsItem) and isQObjectAlive(o) and o.scene() is None:
ReferenceError: weakly-referenced object no longer exists

Looking at the code I see o comes from gc.get_objects(). I cannot realize how garbage collector can hold a deleted weak reference if its main purpose is to cleanup such an objects?? Also don't know how to make any workaround. This is extract from real code, I need all the libraries imported.

This is target source:

308     import gc
309     s = QtGui.QGraphicsScene()
310     for o in gc.get_objects():
311         try:
312             if isinstance(o, QtGui.QGraphicsItem) and isQObjectAlive(o) and o.scene() is None:
313                 if getConfigOption('crashWarning'):
314                     sys.stderr.write('Error: graphics item without scene. '
315                         'Make sure ViewBox.close() and GraphicsView.close() '
316                         'are properly called before app shutdown (%s)\n' % (o,))
317 
318                 s.addItem(o)
319         except RuntimeError:  ## occurs if a python wrapper no longer has its underlying C++ object
320             continue
0

There are 0 answers