Skip to main content
Question

FME2023 fmeobjects folder installation missing python folders?


blueinc
Contributor
Forum|alt.badge.img+6

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

 

12 replies

hkingsbury
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • February 14, 2024

It looks like they’ve moved into the python folder

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


blueinc
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 14, 2024

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


hkingsbury
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • February 14, 2024

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)

 


blueinc
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 15, 2024

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 51in <module>
    import fmeobjects
ImportError: DLL load failed while importing fmeobjects: The specified module could not be found.

Your thoughts?

 

Thanks for this,

Brian


hkingsbury
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • February 15, 2024
blueinc wrote:

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 51in <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?


blueinc
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 16, 2024

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


thejando
Contributor
Forum|alt.badge.img+4
  • Contributor
  • December 6, 2024

I’m working with FME 2024.2 on Windows 10 using the Python 3.11 libraries installed with ArcGIS Pro. I’ve also had some trouble with this, but have found a solution.

There appears to be a fme.dll file in the C:\Program Files\FME\loader which is important.

The solution I found is as follows:

fme_home =  r"C:\Program Files\FME"
fme_py = os.path.join(fme_home, r"python")
fme_dll = os.path.join(fme_home, r"loader")
sys.path.append(fme_py)
os.add_dll_directory(fme_home)
os.add_dll_directory(fme_dll)
import fmeobjects

 


blueinc
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • March 25, 2025
thejando wrote:

I’m working with FME 2024.2 on Windows 10 using the Python 3.11 libraries installed with ArcGIS Pro. I’ve also had some trouble with this, but have found a solution.

There appears to be a fme.dll file in the C:\Program Files\FME\loader which is important.

The solution I found is as follows:

fme_home =  r"C:\Program Files\FME"
fme_py = os.path.join(fme_home, r"python")
fme_dll = os.path.join(fme_home, r"loader")
sys.path.append(fme_py)
os.add_dll_directory(fme_home)
os.add_dll_directory(fme_dll)
import fmeobjects

 

 ​@thejando : We recently updated to Python 3.11 and our previous solution stopped working so I’ve implemented your solution. It works fine to import the fmeobjects but if I try to implement any calls with it, like creating a log file, it totally crashes the python script:

logger_FME = fmeobjects.FMELogFile()  # ISSUE: crashes here. Doesn't throw Exception


Just give a popup window with: ‘Application has stopped working’ in the popup title and: Please wait while we gather information about the error…
Are you able to create an instance of the fmeobjects.FMELogFile() class?
TIA,
Brian


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • March 25, 2025

Hi ​@blueinc,

After updating your os.path with the fme folders, please add:

import os

# Modify the path if FME is installed in another location
os.environ['FME_HOME'] = r"C:\Program Files\FME"

import fmebootstrap
import fmeobjects

 


blueinc
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • March 26, 2025

Thanks for your reply ​@daveatsafe Now getting:
ImportError: DLL load failed while importing fmeobjects: A dynamic link library (DLL) initialization routine failed.
 

fme_home = r"E:\sw_nt\FME"
os.environ['FME_HOME'] = r"E:\sw_nt\FME"
fme_py = os.path.join(fme_home, r"python")
fme_dll = os.path.join(fme_home, r"loader")
sys.path.append(fme_py)
os.add_dll_directory(fme_home)
os.add_dll_directory(fme_dll)
sys.path.append(fme_home)  # try adding to sys.path?
sys.path.append(fme_dll)  # try adding to sys.path?
os.chdir(fme_home)  # do this (somehow needed)

import fmebootstrap
import fmeobjects

Fails on the last line importing fmeobjects

p.s. changed the order slightly; same result:   

    fme_home = r"E:\sw_nt\FME"
    fme_py = os.path.join(fme_home, r"python")
    fme_dll = os.path.join(fme_home, r"loader")
    sys.path.append(fme_py)
    os.add_dll_directory(fme_home)
    os.add_dll_directory(fme_dll)
    sys.path.append(fme_home)  # try adding to sys.path?
    sys.path.append(fme_dll)  # try adding to sys.path?
    os.environ['FME_HOME'] = fme_home
    os.chdir(fme_home)  # do this (somehow needed)

    import fmebootstrap
    import fmeobjects

 


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • March 27, 2025

Hi ​@blueinc,

Are you running Python 32 bit or 64 bit?


blueinc
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • March 27, 2025

Python 3.11.10 64-bit


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings