Skip to main content
Question

Python scripting using command line on FME Cloud

  • January 15, 2020
  • 3 replies
  • 123 views

helmoet
Forum|alt.badge.img+8

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

david_r
Celebrity
  • January 15, 2020

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")

helmoet
Forum|alt.badge.img+8
  • Author
  • January 19, 2020
david_r wrote:

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. 


helmoet
Forum|alt.badge.img+8
  • Author
  • January 19, 2020

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings