6

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

1 Answer 1

8

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

2
  • that's great and this is working for me as well, can you post related documentation? or where did you find this?? Commented Apr 19, 2017 at 21:55
  • Sorry, I found this some time ago in a similar question.. seems like i can't find it again. About documentation, I've been looking for it too without success. the only link I can send you is the user manual but it does not help much
    – xlDias
    Commented May 3, 2017 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.