Skip to main content
Question

Python scripting using command line on FME Cloud

  • January 15, 2020
  • 3 replies
  • 136 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?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

david_r
Celebrity
  • 8392 replies
  • 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
  • 195 replies
  • January 19, 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")

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
  • 195 replies
  • January 19, 2020

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