Skip to main content

I’m trying to discover why my stand-alone python script cannot now ‘import fmeobjects’ after an upgrade of FME Desktop 2022.2 to FME Forms 2023.2.2.

The sys.append path that worked previously had a python version subfolder inside the installation’s fmeobjects folder, like this:

if os.path.isdir(rf"{FME_HOME}\fmeobjects\{python_subfolder}"):
os.add_dll_directory(FME_HOME)
sys.path.append(rf'{FME_HOME}\fmeobjects\{python_subfolder}")
sys.path.append(FME_HOME)
os.chdir(FME_HOME)
import fmeobjects

but those python subfolders are no longer there inside the fmeobjects folder in the Form current installation, but rather are outside in their own ‘python’ folder now. Is this correct? It seems that most of the searching I’ve done has the path to the python version as a subfolder of fmeobjects folder.

No amount of appending sys.path versions of the python_subfolder will allow python to correctly ‘import fmeobjects’ and not stop producing:

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

What gives? TIA

Brian

 

It looks like they’ve moved into the python folder

"C:\Program Files\FME 2023.2.1\python\fmewebservices.cp311-win_amd64.pyd"


I tried setting the append to the {FME_HOME}\python but still cannot import fmeobjects. How can I get python to recognize it?


I got it working on 3.10 with:

import os, sys


fme_dir =  'C:\Program Files\FME 2023.2.1'
os.add_dll_directory(fme_dir)


fme_py = os.path.join(fme_dir, 'python')
sys.path.append(fme_py)


import fmeobjects
help(fmeobjects)

 


It odd but the exact same code fails here:

    fme_dir = r"<path-to-FME-home>"
    os.add_dll_directory(fme_dir)

    fme_py = os.path.join(fme_dir, "python")
    sys.path.append(fme_py)

    import fmeobjects

    help(fmeobjects)

Traceback (most recent call last):
  File "<path-to-testing>.py", line 51, in <module>
    import fmeobjects
ImportError: DLL load failed while importing fmeobjects: The specified module could not be found.

Your thoughts?

 

Thanks for this,

Brian


It odd but the exact same code fails here:

    fme_dir = r"<path-to-FME-home>"
    os.add_dll_directory(fme_dir)

    fme_py = os.path.join(fme_dir, "python")
    sys.path.append(fme_py)

    import fmeobjects

    help(fmeobjects)

Traceback (most recent call last):
  File "<path-to-testing>.py", line 51, in <module>
    import fmeobjects
ImportError: DLL load failed while importing fmeobjects: The specified module could not be found.

Your thoughts?

 

Thanks for this,

Brian




What version of python are you using?


Actually our systems tech wiz discovered the sequence of commands that made it work:

fme_home = r"<path-to-fme>"
fme_py = os.path.join(fme_home, r"python")
fme_dir = os.path.join(fme_py, r"fmeobjects")
sys.path.append(fme_dir)
sys.path.append(fme_py)  # add this
os.chdir(fme_home)  # do this too (somehow needed)
import fmeobjects

print(fmeobjects)

Thanks for your helpful input!

Cheers...Brian


Reply