Question

Python scripting using command line on FME Cloud

  • 15 January 2020
  • 3 replies
  • 27 views

Badge +2

Hi, On FME Cloud I tried to execute the statement "FME PYTHON" and a python script. I am using a SystemCaller, which works on my Windows FME Desktop. The Python script is from a third party that should be run over the outcome of a workspace, and I don't intend to adapt it. However, the workspace did not run on FME Cloud. After some experimenting I learned that - since Cloud runs on Ubuntu - this still works, however, the path to the FME executable should be /opt/fme-engine-2019/fme. My question: Is this a correct way to run a Python script? Or is there a way to just run Python script from the PythonCaller?


3 replies

Userlevel 4

Could you perhaps use a SystemCaller to call something like

python $(FME_SHAREDRESOURCE_DATA)/my_python_script.py

This would execute the python script located in the FME Server shared resources "Data" folder, regardless on which operating system.

You can of course also run the Python script from the PythonCaller, but it would basically just be a wrapper for the same thing. Example:

import os
os.system(FME_MacroValues[FME_SHAREDRESOURCE_DATA] + "/my_python_script.py")
Badge +2

Could you perhaps use a SystemCaller to call something like

python $(FME_SHAREDRESOURCE_DATA)/my_python_script.py

This would execute the python script located in the FME Server shared resources "Data" folder, regardless on which operating system.

You can of course also run the Python script from the PythonCaller, but it would basically just be a wrapper for the same thing. Example:

import os
os.system(FME_MacroValues[FME_SHAREDRESOURCE_DATA] + "/my_python_script.py")

Hay David, that didn't work. It gives me (single, double or not quoted at all):

0684Q00000ArMF1QAN.jpgHowever, the way I described it in the question did work. I wanted to know if this is an accepted way of running python scripts. And if the criterion would be "if it works, it's ok" then probably it is a good way to run py. 

Badge +2

runpythonscriptfromcommand.fmwTo complete the question, here is the setup that worked for me.

Reply