<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Zoltan,</p>
<p>the most important thing first: Don't fall into the "AI can
program" mindset trap. You *will* end up with nonsense like this
if you do. Those tools can often hallucinate non-existent APIs and
mislead you. They might work for some more basic or wide-spread
code bases but so far I have seen very bad results for PyQGIS.
Best search the web using "pyqgis" as additional keyword to your
query.<br>
</p>
<p>As <a class="moz-txt-link-freetext" href="https://qgis.org/pyqgis/3.34/core/QgsProcessing.html">https://qgis.org/pyqgis/3.34/core/QgsProcessing.html</a> says,
that class only contains data to be used by Processing things. It
is not your entry point into using Processing via Python.</p>
<p>For that please see
<a class="moz-txt-link-freetext" href="https://docs.qgis.org/3.34/en/docs/user_manual/processing/console.html">https://docs.qgis.org/3.34/en/docs/user_manual/processing/console.html</a>
, written by actual, smart humans ;)</p>
<p>And for the Batch file: Don't write your own, QGIS comes with a
perfect one already, called <code>python-qgis[-ltr].bat</code> .
See e.g. <a class="moz-txt-link-freetext" href="https://gis.stackexchange.com/a/428577/51035">https://gis.stackexchange.com/a/428577/51035</a></p>
<p>Cheers and good luck!<br>
Hannes<br>
</p>
<div class="moz-cite-prefix">On 11.03.24 09:30, Zoltan Szecsei via
QGIS-User wrote:<br>
</div>
<blockquote type="cite"
cite="mid:c8856472-53b5-481a-9e8e-8c5b546fd550@geograph.co.za">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
Hi,<br>
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.<br>
<br>
There are 2 questions in this email:<br>
<br>
I have a Windows 11 OSGEO4W installation QGIS 3.36.0 and grass
(and more).<br>
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.<br>
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.<br>
<br>
So, in this scenario below, I keep getting: ..... <b>has no
attribute 'run'<br>
</b>This whether I am running inside PyCharm or on the
command-line through below batch job.<br>
<br>
<b>Question #1</b><br>
<b>What is the correct bat file structure for running python
scripts?</b><br>
I currently have [below] but is it optimal?<br>
<blockquote>SET QGIS_PATH=C:\OSGeo4W\apps\qgis<br>
call "C:\OSGeo4W\bin\o4w_env.bat"<br>
SET PYTHONPATH=%QGIS_PATH%\python;%PYTHONPATH%<br>
SET PATH=%QGIS_PATH%\bin;%PATH%<br>
C:\OSGeo4W\apps\Python39\python.exe
Z:\Projects\Development\python_QGIS\qgis_tests\qgisrun.py<br>
pause<br>
</blockquote>
<b>Question #2</b><br>
I have tried many various import options, but I cannot get past
the <b>has no attribute 'run'</b> error from python below code:<br>
Minimalst as this code is, it should run without adding anything
else, should it?<br>
<blockquote>from qgis.core import QgsProcessing<br>
shp_inErfPoly = 'Z:\\Erven_1February2024.shp'<br>
shp_outErfFix = 'Z:\\Erven_1February2024_FixGeo.shp'<br>
QgsProcessing.run("native:fixgeometries", { 'INPUT':
shp_inErfPoly, 'METHOD': 1, 'OUTPUT': shp_outErfFix})<br>
</blockquote>
<br>
<br>
Some pointers on what to do or where to read would be great.<br>
<br>
Thanks in advance,<br>
Zoltan<br>
<br>
<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
=============================================
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
<a class="moz-txt-link-abbreviated" href="http://www.geograph.co.za"
moz-do-not-send="true">www.geograph.co.za</a>
=============================================</pre>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
QGIS-User mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-User@lists.osgeo.org">QGIS-User@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Johannes Kröger / GIS-Entwickler/-Berater
*********************************************
FOSSGIS Konferenz
20.-23. März 2024 in Hamburg
<a class="moz-txt-link-freetext" href="https://www.fossgis-konferenz.de/2024/">https://www.fossgis-konferenz.de/2024/</a>
WhereGroup-Beiträge auf der FOSSGIS
<a class="moz-txt-link-freetext" href="https://wheregroup.com/unternehmen/aktuelles/">https://wheregroup.com/unternehmen/aktuelles/</a>
*********************************************
WhereGroup GmbH
c/o KK03 GmbH
Lange Reihe 29
20099 Hamburg
Germany
Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11
<a class="moz-txt-link-abbreviated" href="mailto:johannes.kroeger@wheregroup.com">johannes.kroeger@wheregroup.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.wheregroup.com">www.wheregroup.com</a>
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------------------------
</pre>
</body>
</html>