That error message indicates that the FME compatibility setting option is set to a different python version than what FME is looking for.
How is your python script calling the FME workbench? Did you match the FME python
scripting compatibility option to the correct version of python PRO deploys?:You can confirm the python version of your ArcGIS PRO through the python interpreter:
import sysPRO 2.9 should be using python 3.7, this version will need to match the fmeobjects called in FME for most situations.
There is no guarantee that your python call (from your picture) is choosing the correct python.exe in PATH, it is usually better to directly specify the python version you wish to call unless you configured the PRO license and PRO python.exe onto your system PATH.
For example: Usually PRO’s python .exe standard install (64bit) is something
like this:
"C:\\ProgramFiles\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python.exe"
FME 64bit path if standard install:
r"C:\\ProgramFiles\\FME\\fme.exe"
If you want to use ‘fmeobjects’ through the python API, I recommend that you ‘edit and run the script’ directly through ArcGIS PRO so it calls the appropriate python dependencies. You can accomplish by:
- Right-clicking on the script and selecting edit with IDLE (ArcGIS Pro) and then running the python script in the idle application
Then you would system path append the appropriate fmeobjects python api to your system and then you can call and run your workbench.
- Or you will need to call the ArcGIS PRO python.exe directly and run the workbench through a command line f’string’ (my preferred method since it eliminates the python dependency between python and fmeobjects).
@boydfme Thanks for the information.
Tried using "selecting edit with IDLE (ArcGIS Pro) and then running the python script in the idle application" and got this error message - "No module named fmeobjects". tried adding the path to environment setting, but still the same error message. Let me know if I am missing something here. Is any other installation required ?
Can you elaborate on this ? "you will need to call the ArcGIS PRO python.exe directly and run the workbench through a command line f’string’ (my preferred method since it eliminates the python dependency between python and fmeobjects)." Thanks
Any fmeobjects have to be imported in after the sys.append(<path to fmeobjects) FYI. I see in your python window from fmeobjects trying to import before the sys.append() command.
sys.path.append(r"C:\\Program Files\\FME\\fmeobjects\\python37") #any fmeobject imports must be below this
Can you elaborate on this ? "you will need to call the ArcGIS PRO python.exe directly and run the workbench through a command line f’string’ (my preferred method since it eliminates the python dependency between python and fmeobjects)." Thanks
I was referring to my 2nd example in the text file i attached above. So instead of trying to import fmeobjects and relying on correct installations of fme .dll and python objects, you can use the python module: subprocess to execute fme.exe through a command line call (just like you would in a cmd prompt). When you send the fme workbench commands with parameters they must be formatted as an f'string' when used inside python.
So a fme workbench is usually ran in a cmd line for example like this:
But to do this same execution in python - subprocess, it would look like this:
Notice how you don't need fmeobjects or other dependencies. It is a good workaround for those that may have multiple installations of python or fme etc. on their machine.
Example idle run:
You'll need to adjust the command python variable to use the parameters of your workbench (if needed) and then also adjust the standard out and standard error text outputs to your desired message responses (or just eliminate the text messages all together for simplicity sake).
And the fme workbench needs to be the 'full path .fmw' (ie dataa2]).
Any fmeobjects have to be imported in after the sys.append(<path to fmeobjects) FYI. I see in your python window from fmeobjects trying to import before the sys.append() command.
sys.path.append(r"C:\\Program Files\\FME\\fmeobjects\\python37") #any fmeobject imports must be below this
Can you elaborate on this ? "you will need to call the ArcGIS PRO python.exe directly and run the workbench through a command line f’string’ (my preferred method since it eliminates the python dependency between python and fmeobjects)." Thanks
I was referring to my 2nd example in the text file i attached above. So instead of trying to import fmeobjects and relying on correct installations of fme .dll and python objects, you can use the python module: subprocess to execute fme.exe through a command line call (just like you would in a cmd prompt). When you send the fme workbench commands with parameters they must be formatted as an f'string' when used inside python.
So a fme workbench is usually ran in a cmd line for example like this:
But to do this same execution in python - subprocess, it would look like this:
Notice how you don't need fmeobjects or other dependencies. It is a good workaround for those that may have multiple installations of python or fme etc. on their machine.
Example idle run:
Thanks @boydfme It is super helpful. It works...You could probably make this as an article and it would certainly help others.