Question

Custom Python module locations in FME Server

  • 1 October 2019
  • 3 replies
  • 19 views

Badge

Hi. I have a workspace that uses custom python module inside a python caller. I'm trying to run the workspace via FME server. I've set my python compatibility to 3.5+ and uploaded the python module that i'm using to the servers engine\\plugins\\python\\python35 folder according to the FME instructions here:

https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Workbench/Workbench/Importing_Custom_Python_Modules_FMEServer.htm

However, the workspace yet can't locate the module and i'm still getting the error "no module xx found"

What i'm doing wrong? Where should i copy the module? I can't use pip install, because the server machine does not have internet access.

I've managed to work this around somehow before, but now the server has been updated and the module is gone.

So what actually is the correct path to the python that FME server is using? Is there a way to check it out?


3 replies

Userlevel 4

The PYTHONPATH should be in the FME job log, if I'm not mistaken.

If not, you can easily check it your self:

  1. Create a new, empty workspace with a Creator -> PythonCaller
  2. In the PythonCaller, use the following code
import sys
import fmeobjects
 
def print_python_path(feature):
    for p in sys.path:
        fmeobjects.FMELogFile().logMessageString('PYTHONPATH: ' + p)

This will output several lines in the FME job log that states where the FME Python interpreter is looking for modules when it encounters an import statement.

 

Badge

The PYTHONPATH should be in the FME job log, if I'm not mistaken.

If not, you can easily check it your self:

  1. Create a new, empty workspace with a Creator -> PythonCaller
  2. In the PythonCaller, use the following code
import sys
import fmeobjects
 
def print_python_path(feature):
    for p in sys.path:
        fmeobjects.FMELogFile().logMessageString('PYTHONPATH: ' + p)

This will output several lines in the FME job log that states where the FME Python interpreter is looking for modules when it encounters an import statement.

 

Thank you, i was able to locate the correct path where i should add the python module, and it's working now! The log told me what python interpreter it is using and from where (PYTHONHOME path), and after copying the module to that path, everything worked.

However i'm still confused that the FME instructions i mentioned above is not working.

 

Userlevel 4

Thank you, i was able to locate the correct path where i should add the python module, and it's working now! The log told me what python interpreter it is using and from where (PYTHONHOME path), and after copying the module to that path, everything worked.

However i'm still confused that the FME instructions i mentioned above is not working.

 

Unfortunately sometimes the software changes faster than the documentation. If you think it's an error, please consider contacting Safe and let them know. They're fairly quick to fix these things.

Reply