[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qgis-developer
Subject:    Re: [QGIS-Developer] Pyinstaller to create stand alone app
From:       Benjamin Jakimow via QGIS-Developer <qgis-developer () lists ! osgeo ! org>
Date:       2022-07-13 7:49:25
Message-ID: 9faf4895-749d-8092-cf77-0cd4d07ff67b () geo ! hu-berlin ! de
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Hi Luke,

it looks like your QGISenv.bat does not add the QGIS internal plugin 
folder to the PYTHONPATH.

You may use something like:

set PYTHONPATH=^
%OSGEO4W_ROOT%\apps\%QGIS_ENV%\python;^
%OSGEO4W_ROOT%\apps\%QGIS_ENV%\python\plugins;^
%PYTHONPATH%

where OSGEO4W_ROOT is the path to where your QGIS is installed, and 
QGIS_ENV the release type, e.g. "qgis" or "qgis-ltr"

Greetings, Benjamin


Am 13/07/2022 um 03:54 schrieb Catania, Luke A ERDC-RDE-GRL-VA CIV via 
QGIS-Developer:
> 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
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
Benjamin Jakimow, Doctoral Researcher
Earth Observation Lab | Geography Department | Humboldt-Universität zu Berlin

e-mail: benjamin.jakimow@geo.hu-berlin.de

phone:  +49 (0) 30 2093 6846
mobile: +49 (0) 157 5656 8477
fax:    +49 (0) 30 2093 6848
mail:   Unter den Linden 6 | 10099 Berlin | Germany
room: 2'211
web:    https://hu-berlin.de/eo-lab


["smime.p7s" (application/pkcs7-signature)]

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic