6

I am trying to get information from a QGIS project and layers and produce a new project based on new analysis results made on FME.

How to install the PyQGIS module and then using the custom python interpreter in FME Desktop?

I am using QGIS-ltr 2.18.23 (from OSGEO4w64) and FME 2018.1.0.1 (Win64). And the python/QGIS related paths into PATH environmental variable are: C:\OSGeo4W64\apps\qgis-ltr\bin; C:\OSGeo4W64\apps\Python27; C:\OSGeo4W64\bin

In FME desktop I am reading the C:\OSGeo4W64\bin\python27.dll as the preferred Python interpreter and PYHTONHOME path is: C:\OSGeo4W64\apps\qgis-ltr\python

1 Answer 1

2

I believe QGIS uses/installs Python 2.7, so that's OK. FME is compatible with both 2.7 and 3 for now (although 2.7 is being phased out).

Under Tools > FME Options > Translation set the Python interpreter to the QGIS DLL and set the Python home folder. I believe the QGIS Python dll can be found under QGIS\bin\python27.dll and the home folder is QGIS\apps\Python27

enter image description here

You can also set PYTHONHOME as an environment variable too. You'll also need to make sure that qgis_core.dll is included in your PATH setting as well.

1
  • I am not using those paths as i am using the osgeo4w64 install. I edited the question to give you more details on pyhtonhome and path environmental variable regarding qgis/python. So using another paths for reaching QGIS python, i am actually reaching the python27.dll interpreter and keeping qgis_core.dll in the path environmental variable. And unfortnutately, it does not work. Have you tried to load any python module from QGIS using python caller? does it work? Sep 18, 2018 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.