Solved

Use of fmeobjects (python)

  • 2 March 2023
  • 2 replies
  • 100 views

I have a workflow which calls Workspaces from a python script (Python 3.7.2 running in Spyder).

 

Because of an issue/bug I encountered, I was advised to install the newest version of FME and see if the problem persists. Now I cannot get my scripts to work again.

 

This works:

sys.path.append("C:\\Program Files\\FME\\fmeobjects\\python37")
 
import fmeobjects
 
(...)
 
runner = fmeobjects.FMEWorkspaceRunner()  
(...)
runner.runWithParameters(ws, parameters) 
(...)

 

This doesn't:

sys.path.append("C:\\Program Files\\FME2022_2_3\\fmeobjects\\python37")
 
import fmeobjects
 
(...)
 
runner = fmeobjects.FMEWorkspaceRunner()  
(...)
runner.runWithParameters(ws, parameters) 

All I did was change the path from the old installation to the new one.

It fails, saying the module is not found

 

 File "c:/data/data.py", line 24, in <module>

   import fmeobjects

 

ImportError: DLL load failed: The specified module could not be found.

 

It seems it actually finds "fmeobjects", but something else is missing. I suspect some underlying environment setting is the issue, but I can't resolve it. Neither PATH nor PYTHONPATH had any link to the old FME installation, so I don't know where to start. Old version is 2021.1.2, new is 2022.2.3.

All I could figure out, was that I need to remove the old directory from sys.path as there is an obvious conflict otherwise. 

 

 

icon

Best answer by daveatsafe 2 March 2023, 20:44

View original

2 replies

Userlevel 2
Badge +17

Hi @riverag​,

If you have multiple versions of FME on your computer, FMEObjects will attempt to use the first one it finds in the Windows Path. In your case it is likely that FME 2021.1.2 is before FME 2022.2.3, and so there is an FMEObjects/FME mismatch.

Please edit the Windows Path in the Windows Environment Variables - System variables, so that FME 2022.2.3 is the first FME to be found.

I don't know how I can be 100% sure, that it's running the right version, but it seems like this did the trick!

Reply