Skip to main content
Question

fmeobjects has no attribute in python 3.7.

  • May 28, 2020
  • 6 replies
  • 216 views

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)
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.

6 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • 1637 replies
  • May 28, 2020

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

 


  • Author
  • 3 replies
  • May 28, 2020

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.

carsonlam
Safer
Forum|alt.badge.img+7
  • Safer
  • 62 replies
  • May 28, 2020

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.


  • Author
  • 3 replies
  • May 28, 2020

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?

 


  • Author
  • 3 replies
  • May 29, 2020

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.


carsonlam
Safer
Forum|alt.badge.img+7
  • Safer
  • 62 replies
  • May 29, 2020

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.