[QGIS-Developer] Pyinstaller to create stand alone app

Catania, Luke A ERDC-RDE-GRL-VA CIV Luke.A.Catania at erdc.dren.mil
Tue Jul 12 18:54:08 PDT 2022


I have the need to launch QGIS from a python file due to some other checks I need to setup before it is running.  I convert this python file to an exe but Windows Defender flags it as a virus.  The exe is created from a batch (.cmd) file with the following calls:

call "QGISenv.bat"
call "python3.exe  jcms_authenticate.py"

The jcms_authenticate.py file is what launches QGIS using a python Popen method.  I used bat2exe converter to convert my CMD file to an exe.  

I came across another method to convert python directly to an exe using pyinstaller but have had issues as mentioned  in the link below.  I am not using QGIS 3.4.4 but QGIS 3.16.16 and assume there is still the issue as I cannot successfully get the exe to work as I get the error:

Traceback (most recent call last):
  File "jcms_authenticate.py", line 7, in <module>
    from qgis.core import QgsApplication
ModuleNotFoundError: No module named 'qgis'
[37080] Failed to execute script 'jcms_authenticate' due to unhandled exception!

https://issues.qgis.org/issues/21341


More information about the QGIS-Developer mailing list