When using processing tool in pyqgis and run, it always creates a progress bar. Is there a way to disable it?
processing.runalg('qgis:fixeddistancebuffer', _layer, distance_tolerance, 10, False, None)
I want to disable it because I get this error when I run my script in travis:
wrapped C/C++ object of type QProgressBar has been deleted See log for more details
RuntimeError: wrapped C/C++ object of type QProgressBar has been deleted
Answer
This works for me:
processing.runalg('qgis:fixeddistancebuffer', _layer, distance_tolerance, 10, False, None, progress=None)
Just add "progress = None" and you may be good to go
Update: I figured out that you can actually keep track of the process's progress using some kind of dummy progress object. Here's what I have:
class DummyProgress(object):
def __init__(self):
pass
def error(self, er_msg):
print er_msg
def setPercentage(self, percent):
print str(percent)
def setText(self, text):
print text
def setCommand(self, comd):
print comd
Instantiate an object from this class and pass it as argument to progress
in your runalg and you will have everything that is happening printed to your console
No comments:
Post a Comment