TLDR: sys.path
does not contain FME_MF_DIR
, so I can’t directly import a local Python module. This contradicts FME’s documentation. What am I missing?
Hi all,
I’m having problems importing a local Python module located in the same directory as my FME workspace. Could you help me find out what the problem is or am I missing something?
According to the PythonCaller documentation,
FME will search both the standard Python module locations and the workspace location to find the module to be imported.
However, when I try to import my module in <workspace directory>/feature_processor/__init__.py
with the following code:
from feature_processor import FeatureProcessor
I get the following exception:
Message Type: fme::internal::_v0::py::Exception
Python Exception <ModuleNotFoundError>: No module named 'feature_processor'
Error executing string `from feature_processor import FeatureProcessor
'
Factory proxy not initialized
FeatureProcessor (PythonFactory): PythonFactory failed to process feature
An error has occurred. Check the logfile above for details
To avoid this error, I’ve appended FME_MF_DIR
to sys.path
, but I’d like to understand why it is that I can’t directly import my module.
I’m currently using FME Form 2024.1.1.1 on Windows 10 x64
Thanks for the help.