[QGIS-Developer] Plugin using Pythonnet fails to start during installation

Benjamin Jakimow benjamin.jakimow at geo.hu-berlin.de
Wed Apr 10 05:13:20 PDT 2024


Dear Lars,

this looks like your plugin's __init__.py (that one that contains the 
"def classFactory(iface)") want's to import the LIFA_ejdexplorer before 
it's location is added to the PYTHONPATH

You may need something like:

sys.path.append('folder to LIFA_ejdexplorer')

before the classFactory(iface) is called.

Greetings,
Benjamin


On 09/04/2024 10:49, Lars I. Nielsen via QGIS-Developer wrote:
> Hi developers.
> 
> We’ve developed a QGIS plugin, that utilizes Pythonnet to communicate 
> with C# on Windows.
> 
> Pythonnet is not part of the chosen distribution for Python in QGIS (as 
> of 3.34), so we do a separate installation of this module into 
> %APPDATA%/Python, which is used by all Python distributions on the PC.
> 
> But even after Pythonnet has been installed correctly, we get an error 
> when the QGIS plugin installer tries to start the plugin.
> 
> However, the plugin has been installed correctly, and it starts just 
> fine when one manually activates it in the plugin window list.
> 
> Why can’t the plugin start when activated by the QGIS plugin installer ?
> 
> Is it running in some kind of restricted environment, that excludes use 
> of the APPDATA location ?
> 
> Cheers.
> 
> Ps!
> 
> We are aware of different versions of Pythonnet in Python 3.7 vs 3.9. We 
> install both.
> 
> Med venlig hilsen
> 
> *Lars I. Nielsen*
> 
> GIS-kons., FME+Python Certified Professional
> 
> GeoData
> 
> 	
> 
> 	
> 
> Dir.
> 
> 	
> 
> +4563136849 <tel:+4563136849>
> 
> Tlf.
> 
> 	
> 
> +4563136800 <tel:+4563136800>
> 
> Mail
> 
> 	
> 
> +lin at lifa.dk <mailto:lin at lifa.dk>
> 
> 	
> 
> 	
> 
> 	
> 
> LIFA A/S · Tlf +4563136800 <tel:+4563136800>· lifa.dk 
> <https://www.lifa.dk/>· CVR 20937289
> 
> Odense · Fredericia · Glostrup · Hillerød · Kerteminde · Kolding · 
> Middelfart · Vejle · Vissenbjerg · Aarhus
> 
> <https://www.linkedin.com/company/lifa-a-s/>
> 
> 	
> 
> Følg os på LinkedIn og læs de seneste nyheder fra LIFA A/S.
> 
> 
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
Dr. Benjamin Jakimow
Earth Observation Lab | Geography Department | Humboldt-Universität zu 
Berlin

e-mail: benjamin.jakimow at 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

matrix: @jakimowb:hu-berlin.de
web:    https://hu-berlin.de/eo-lab


More information about the QGIS-Developer mailing list