I have QGIS 2.18.18 and 2.18.19 in seperate computers. I use the following script to remove RubberBand
items. It works in 2.18.18 but doesn't work in 2.18.19
import qgis
# Get RubberBands
rbs = [ i for i in iface.mapCanvas().scene().items()
if issubclass(type(i), qgis._gui.QgsRubberBand) ]
# Remove RubberBands
for rb in rbs:
if rb in iface.mapCanvas().scene().items():
iface.mapCanvas().scene().removeItem(rb)
Colored polygons are RubberBand items.