[Qgis-user] "QgsProcessing" has no attribute 'run' (same for 'processing')

Zoltan Szecsei zoltans at geograph.co.za
Mon Mar 11 01:30:52 PDT 2024


Hi,
Apologies for asking help on what hopefully might turn out to be 
trivial, but I am pretty much blue in the face googling and asking 
Gemini for help.

There are 2 questions in this email:

I have a Windows 11 OSGEO4W installation QGIS 3.36.0 and grass (and more).
I use PyCharm 2023.3.4 (Community Edition) - but not yet configured 
"nicely" for QGIS as I am mostly in a non-Open Source environment.
Most of the stuff I write is python is for "problem fixes" and these 
python scripts ideally run on a windows command-line with a BAT file.

So, in this scenario below, I keep getting:       ..... *has no 
attribute 'run'
*This whether I am running inside PyCharm or on the command-line through 
below batch job.

*Question #1*
*What is the correct bat file structure for running python scripts?*
I currently have [below] but is it optimal?

    SET QGIS_PATH=C:\OSGeo4W\apps\qgis
    call "C:\OSGeo4W\bin\o4w_env.bat"
    SET PYTHONPATH=%QGIS_PATH%\python;%PYTHONPATH%
    SET PATH=%QGIS_PATH%\bin;%PATH%
    C:\OSGeo4W\apps\Python39\python.exe
    Z:\Projects\Development\python_QGIS\qgis_tests\qgisrun.py
    pause

*Question #2*
I have tried many various import options, but I cannot get past the *has 
no attribute 'run'*  error from python below code:
Minimalst as this code is, it should run without adding anything else, 
should it?

    from qgis.core import QgsProcessing
    shp_inErfPoly = 'Z:\\Erven_1February2024.shp'
    shp_outErfFix = 'Z:\\Erven_1February2024_FixGeo.shp'
    QgsProcessing.run("native:fixgeometries", { 'INPUT': shp_inErfPoly,
    'METHOD': 1,  'OUTPUT': shp_outErfFix})



Some pointers on what to do or where to read would be great.

Thanks in advance,
Zoltan




-- 

=============================================
Zoltan Szecsei GPrGISc 0031
Director, Geograph (Pty) Ltd.
GIS and Photogrammetric Services

Cape Town, South Africa.

Mobile: +27-83-6004028 (Signal, not WhatsApp)
         +974-5058-8729
         +36-20-4808362

www.geograph.co.za
=============================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20240311/3661a390/attachment.htm>


More information about the QGIS-User mailing list