I have a Python script that executes a set of tools in QGIS. I would like to execute this Python script through FME.
In FME Desktop, is it possible to run a python script that is stored on disk, and not within the Python caller?
I have a Python script that executes a set of tools in QGIS. I would like to execute this Python script through FME.
In FME Desktop, is it possible to run a python script that is stored on disk, and not within the Python caller?
Best answer by lifalin2016
Hi.
Not really possible with the built-in PythonCaller (defined in fmesuite.py):
PARAMETER_NAME: PYTHONSOURCE
# note: not this is not or_attr because we do not want
# expression wrapping.
PARAMETER_TYPE: OPTIONAL TEXT_EDIT FME_SYNTAX%PYTHON%FME_INLINE%YES
PARAMETER_PROMPT: Python Script:
PARAMETER_DEFAULT: import<space>fme<lf>import<space>fmeobjects<lf>...
You could build another version yourself with such a feature, but it sounds more like you want to have an external tool library (module) available for your Python code, and this is very possible.
Such modules need to be stored under either %FME_HOME%/Python or %APPDATA%/Roaming/Python, or at least in a folder included in the environment variable PYTHON_PATH.
Then just import it into your Python code.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.