Skip to main content
Solved

Use of fmeobjects (python)

  • March 2, 2023
  • 2 replies
  • 363 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. 

 

 

Best answer by daveatsafe

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.

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.

2 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • 1637 replies
  • Best Answer
  • March 2, 2023

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.


  • Author
  • 14 replies
  • March 2, 2023

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!