My fmw is saved in a directory called C:\\DATA\\VariousTasks. A parameter called InputFolder is pointing to a subfolder of this directory. Is it possible not to use FME MF DIR predefined parameter ? I use a text parameter to point to C:\\DATA\\VariousTasks\\DEV but the script is replacing it automatically by "$(FME_MF_DIR_USERTYPED)DEV" when executing which translates to C:\\DATA\\VariousTasks/DEV . I am using a python script later and python is every sensitive to / and \\ . How can I force FME to use C:\\DATA\\VariousTasks\\DEV instead of $(FME_MF_DIR_USERTYPED)DEV (translating to C:\\DATA\\VariousTasks/DEV) ?
Page 1 / 1
The easiest is probably to simply let Python fix the path for you before using it, e.g.
from pathlib import WindowsPath
import fme
raw_path = FME_MacroValuesa'MY_PUBLISHED_PARAMETER_PATH']
input_path = fme.getAbsolutePath(raw_path)
win_path = str(WindowsPath(input_path).resolve())
with open(win_path) as f:
# Do something here
See also https://docs.python.org/3/library/pathlib.html and https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Form/Configuration/FME_BEGIN_PYTHON.htm