Is it better practice to use
import fme
param = fme.macroValues[‘parameterName’]
or
import fmeobjects
param = FME_MacroValues[‘parameterName’]
in Python scripted parameters and why?
Best answer by daveatsafe
View originalIs it better practice to use
import fme
param = fme.macroValues[‘parameterName’]
or
import fmeobjects
param = FME_MacroValues[‘parameterName’]
in Python scripted parameters and why?
Best answer by daveatsafe
View originalI've noticed that since FME 2018 I've been getting sporadical errors when importing fmeobjects in startup and shutdown scripts on FME Server. My guess is that this is somehow related to how the server engines seem to share session objects between jobs.
So recently I've adopted the following rule, which seems to work for all my use cases.
Startup/shutdown scripts + scripted parameters
import fme
param = fme.macroValues[‘parameterName’]
PythonCaller / PythonCreator
import fmeobjects
param = FME_MacroValues[‘parameterName’]
It would be great if someone from Safe could chime in with the official best-practices.
I've noticed that since FME 2018 I've been getting sporadical errors when importing fmeobjects in startup and shutdown scripts on FME Server. My guess is that this is somehow related to how the server engines seem to share session objects between jobs.
So recently I've adopted the following rule, which seems to work for all my use cases.
Startup/shutdown scripts + scripted parameters
import fme
param = fme.macroValues[‘parameterName’]
PythonCaller / PythonCreator
import fmeobjects
param = FME_MacroValues[‘parameterName’]
It would be great if someone from Safe could chime in with the official best-practices.
Hopefully Safe can give us the official explanation here.
Hi @jdh,
FME_MacroValues is still available for backwards compatibility, but we would recommend that fme.macroValues be used instead.
Hi @jdh,
FME_MacroValues is still available for backwards compatibility, but we would recommend that fme.macroValues be used instead.
Hi @jdh,
FME_MacroValues is still available for backwards compatibility, but we would recommend that fme.macroValues be used instead.
Thanks for catching that. I have created a problem report to have that changed to fme.macroValues instead.
Thanks for catching that. I have created a problem report to have that changed to fme.macroValues instead.
I've noticed that since FME 2018 I've been getting sporadical errors when importing fmeobjects in startup and shutdown scripts on FME Server. My guess is that this is somehow related to how the server engines seem to share session objects between jobs.
So recently I've adopted the following rule, which seems to work for all my use cases.
Startup/shutdown scripts + scripted parameters
import fme
param = fme.macroValues[‘parameterName’]
PythonCaller / PythonCreator
import fmeobjects
param = FME_MacroValues[‘parameterName’]
It would be great if someone from Safe could chime in with the official best-practices.
Remember, though, I'm an old school Tcl guy and Python wannabee-pretender.
I've noticed that since FME 2018 I've been getting sporadical errors when importing fmeobjects in startup and shutdown scripts on FME Server. My guess is that this is somehow related to how the server engines seem to share session objects between jobs.
So recently I've adopted the following rule, which seems to work for all my use cases.
Startup/shutdown scripts + scripted parameters
import fme
param = fme.macroValues[‘parameterName’]
PythonCaller / PythonCreator
import fmeobjects
param = FME_MacroValues[‘parameterName’]
It would be great if someone from Safe could chime in with the official best-practices.
Hi @jdh,
FME_MacroValues is still available for backwards compatibility, but we would recommend that fme.macroValues be used instead.
I'm still seeing the legacy behavior in 2019, at least in Data Interoperability.
i.e. FME_MacroValues
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.