I try to use progress.setPercentage(i/pages) in PyQGIS processing.

I tried to give integers, floats between 0 to 100.


percent = 33
percent = 33.3
percent = 0.33


Nothing appears in the progress bar and no crash.

progress.setText("Blablaba") is working

The script

##Extract then join WS  and attributes=name
##Scripts utilisateur=group
##B1_column_position=number 1
##File_name=string extrWS_geom.shp
# https://medspx.fr/blog/Qgis/verify_oracle_geoalgorithm/  to install cx_oracle

import cx_Oracle
from qgis.core import *
from qgis.core import QgsProject
from PyQt4.QtCore import QFileInfo
from PyQt4.QtCore import QVariant
import os
import datetime


for i in range(pages):

    print("pagination : " + str(i))
    rage = i*1000
    attributesList1000 = convertedDatesattributesList[rage:rage+1000]
    geometriesLayer = getGeoms(writeGeomquery(attributesList1000))
    for attr in attributesList1000 :
        writer.addFeature(joinGeombyID_WS(attr, geometriesLayer))


QGIS documentation:

If your algorithm takes a long time to process, it is a good idea to inform the user. You have a global named progress available, with two possible methods: setText(text) and setPercentage(percent) to modify the progress text and the progress bar.

Several examples are provided. Please check them to see real examples of how to create algorithms using the processing framework classes. You can right-click on any script algorithm and select Edit script to edit its code or just to see it.

  • 1
    Perhaps this post might help: QGIS Processing Progress
    – Joseph
    Sep 15, 2017 at 10:02
  • Maybe it should be progress.setValue(percent)?
    – Joseph
    Sep 15, 2017 at 10:07
  • No it returns an error : AlgorithmDialog' object has no attribute 'setValue' See log for more details
    – jlSta
    Sep 15, 2017 at 10:09
  • 1
    Please, can you try using progress.setPercentage((i/float(pages))*100)?
    – mgri
    Sep 15, 2017 at 14:46
  • 1
    Yes it works. @mgri. Add you answer for votes. ;)
    – jlSta
    Sep 18, 2017 at 13:26

1 Answer 1


Maybe it is related to the division operation. You can try to use:


instead of:


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.