Skip to main content
Question

Issues using fmeobjects in a python script outside of fme. Module has no attributes?

  • July 16, 2019
  • 8 replies
  • 186 views

Forum|alt.badge.img

I'm currently trying to create a script to run a workspace, and test the output against an expected result. However, although I can successful import fmeobjects, it seems to have no attributes?

console example:

 

in a script:

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

 

I'm using fme 2018.1

Any ideas?

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.

8 replies

david_r
Celebrity
  • July 16, 2019

How are you loading the fmeobjects module?

Are you e.g. sure that you've included all the necessary items in the PythonPath? I believe that you'll have to add all these to sys.path before importing fmeobjects (assuming Python 3.6):

<FME>\python
<FME>\python\python36
<FME>\fmeobjects\python36
<FME>\plugins

You may also want to make sure that your FME installation directory is in your PATH.


david_r
Celebrity
  • July 16, 2019

This worked for me with Python 3.6 64-bit (standalone interpreter) with FME 2019.1 64-bit:

>>> import sys
>>> sys.path.append(r'C:\apps\FME-2019-64\plugins')
>>> sys.path.append(r'C:\apps\FME-2019-64')
>>> sys.path.append(r'C:\apps\FME-2019-64\python')
>>> sys.path.append(r'C:\apps\FME-2019-64\python\python36')
>>> sys.path.append(r'C:\apps\FME-2019-64\fmeobjects\python36')
>>> import fmeobjects
>>> dir(fmeobjects)
['BY_FACE', 'FMEAggregate', 'FMEAlpha16Tile', 'FMEAlpha8Tile', ...]

Forum|alt.badge.img
  • Author
  • July 17, 2019

How are you loading the fmeobjects module?

Are you e.g. sure that you've included all the necessary items in the PythonPath? I believe that you'll have to add all these to sys.path before importing fmeobjects (assuming Python 3.6):

<FME>\python
<FME>\python\python36
<FME>\fmeobjects\python36
<FME>\plugins

You may also want to make sure that your FME installation directory is in your PATH.

I have played around with the paths a bit, as at first I couldn't import at all. I find that the only way I can import fmeobjects in pythons stand alone interpreter for 3.6.8 is by having C:\Program Files\FME in the PYTHONPATH. If i use the 4 paths you suggested, i receive an error saying:

ImportError: DLL load failed: The specified procedure could not be found

 

I have also included these paths in path


david_r
Celebrity
  • July 17, 2019

I have played around with the paths a bit, as at first I couldn't import at all. I find that the only way I can import fmeobjects in pythons stand alone interpreter for 3.6.8 is by having C:\\Program Files\\FME in the PYTHONPATH. If i use the 4 paths you suggested, i receive an error saying:

ImportError: DLL load failed: The specified procedure could not be found

 

I have also included these paths in path

Have you verified that you have C:\\Program Files\\FME in your Windows PATH as well (not PYTHONHPATH)?


Forum|alt.badge.img
  • Author
  • July 17, 2019

Have you verified that you have C:\\Program Files\\FME in your Windows PATH as well (not PYTHONHPATH)?

Yes, it is also in my PATH variable. I have a feeling it has an issue specifically with the 36 version of fmeobjects (hence why using the specific paths gives me a different error). I might retry this with a different python version to see if this makes a difference.


david_r
Celebrity
  • July 17, 2019

Yes, it is also in my PATH variable. I have a feeling it has an issue specifically with the 36 version of fmeobjects (hence why using the specific paths gives me a different error). I might retry this with a different python version to see if this makes a difference.

It worked for me using version 3.6, se my other post here...


Forum|alt.badge.img
  • Author
  • July 17, 2019

It worked for me using version 3.6, se my other post here...

I was under the impression that that was using FME 2019 not 2018


Forum|alt.badge.img
  • Author
  • July 26, 2019

Just an update in regards to this. It seems like FME Workbench 2018 must not have installed quite right (despite still being able to open the software, and run it normally). So reinstalling fixed the issue!