Is there still fmeobjects package supporting python 2.7 in FME 2022.2?
I need to run an FME workspace in ArcMap, which uses python 2.7 and realized there is no fmeobjects for Python 2 in the FME installation folder. Is there an alternative way to do the job?
Best answer by david_r
Starting with FME 2022.0 and on, Python 2.7 is no longer supported.
If you need support for Python 2.7, you'll have to stick with FME 2021.
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
You could also use the "subprocess" python module in python 2.7 and run the FME 2022.2 version that way by pointing to the 64bit fme.exe location.
This should allow you to keep using your python 2.7 in desktop and use the new version of FME. Otherwise, to use fmeobjects you would need to follow the advice above.
Here is an example function using the subprocess package:
import subprocess # Can pull the standard out and error messages for useful workbench feedback. def sub__fmeworker(data): """ command variable object houses the subprocess cmd string line and houses 3 parameters. where data is a python dictionary. 1. _workbench = myworkbench.fmw, 2. data[0] = features to run in the workbench, 3. data[1] = log path .txt
The subprocess.Popen() executes the command and retrieves the process outputs to stdout and stderr.""" text = ''
process = subprocess.Popen(command,startupinfo=starter, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = process.communicate() if stderr: stderr_de = str(stderr.decode("utf-8")) # Need to remove byte object msg = stderr_de.split("\r\n")[0] text += data[0] +' '+ msg else: stdout_de = str(stdout.decode("utf-8")) # Need to remove byte object msg = stdout_de.split("\r\n") text += msg+'ERROR########' except: #if the workbench fails add error tag text += data[0]+'ERROR########' return text
Another option would be to create a .bat file with your workbench information and then you can run it in python by just doing a subprocess.call(). I had to use both of these workarounds for a couple projects since the clients still use Desktop and have not migrated to PRO but want the newest fme version.
Example .bat:
REM %1 and %2 are arguments - workbench parameters (if you need those) ## this is a comment
args1 = item[0] #the feature class currently being looped through args2 = item[1] #attached logfile path subprocess.call([bat_file,args1,args2]) # runs the workbench with parameters (%1, %2)