Skip to main content

Hi.

I am trying to run a fme workspace using python 3.7, but I always get:

AttributeError: module 'fmeobjects' has no attribute 'FMEWorkspaceRunner' .

 

In the script I added dir(fmeobjects) and I get:

>'__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

 

I have read several treads in the forum but I cannot found any reason why I don't get all the attributes in fmeobjects. Neither how to solve it. Is my script incomplete? Is there a bug somewhere? Any suggestions?

 

My python compiler is Anaconda => Spyder (Python 3.7)

 

My script is:

import sys

 

 

sys.path.append(r"C:\\Program Files\\FME\\fmeobjects\\python37")

 

 

import fmeobjects

 

 

print(dir(fmeobjects))

 

workspace = r"C:\\Users\\Fredr\\OneDrive\\Documents\\FME\\Workspaces\\Delay.fmw"

 

 

runner = fmeobjects.FMEWorkspaceRunner.run(workspace)

Hi @fredrikb,

The FMEWorkspaceRunner class must be initiated before it can be used. Please see the following article for a complete example on using the FMEWorkspaceRunner:

https://knowledge.safe.com/articles/1158/run-an-fme-workspace-from-python-using-fmeworkspac.html

 


Hi @fredrikb,

The FMEWorkspaceRunner class must be initiated before it can be used. Please see the following article for a complete example on using the FMEWorkspaceRunner:

https://knowledge.safe.com/articles/1158/run-an-fme-workspace-from-python-using-fmeworkspac.html

 

Hi @daveatsafe

Maybe my script is wrong, but I still do not understand why the fmeobjects packages is empty. This is my initial problem.

What's the value of fmeobjects.__path__ and fmeobjects.__file__? The result you're seeing for dir(fmeobjects) could make sense if there's a module name conflict on the PYTHONPATH and something aside from fmeobjects.pyd is being loaded.


What's the value of fmeobjects.__path__ and fmeobjects.__file__? The result you're seeing for dir(fmeobjects) could make sense if there's a module name conflict on the PYTHONPATH and something aside from fmeobjects.pyd is being loaded.

The different values are:

- fmeobjects.__path__ prints out _NamespacePath(['C:\\\\Program Files\\\\FME\\\\fmeobjects'])

- fmeobjects.__file__ prints out None

The fmeobjects.pyd is located in a subfolder of the fmeobjects.__path__ results (C:\\Program Files\\FME\\fmeobjects\\python37 )

Can this missmatch be the reason of empty package?

 


I have no clue why it failed earlier, but now the import fmeobjects works without any problems.

And I also manage to use the FMEWorkspaceRunner.

Thanks for the support and hopefully I will understand why there was a problem with the import fmeobjects.


The different values are:

- fmeobjects.__path__ prints out _NamespacePath(['C:\\\\Program Files\\\\FME\\\\fmeobjects'])

- fmeobjects.__file__ prints out None

The fmeobjects.pyd is located in a subfolder of the fmeobjects.__path__ results (C:\\Program Files\\FME\\fmeobjects\\python37 )

Can this missmatch be the reason of empty package?

 

Your results are a bit unexpected. On my system, fmeobjects.__path__ is not defined and raises AttributeError. fmeobjects.__file__ is the absolute path to fmeobjects.pyd - C:\\Program Files\\FME\\fmeobjects\\python37\\fmeobjects.pyd.

You might want to see if those values have changed, now that you can import fmeobjects.FMEWorkspaceRunner successfully.


Reply