Skip to main content
Solved

In TCL, '$FME_MappingFileId' is used to refer to MappingFileId. How to refer to MappingFileId in Python?

  • March 4, 2014
  • 1 reply
  • 12 views

Forum|alt.badge.img
In TCL, '$FME_MappingFileId'  is used to refer to MappingFileId. How to refer to MappingFileId in Python?

Best answer by takashi

Hi George,

 

 

I was able to get the Mapping File ID with this script.

 

It's not described in official documentations. There might be simpler way.

 

-----

 

# Startup Python Script Example: Get Mapping File ID

 

import fmeobjects

 

 

# Get Mapping File ID via FMESession object.

 

# Mapping File ID will be returned as a list of strings (words).

 

session = fmeobjects.FMESession()

 

mappingFileId = ' '.join(session.getSettings('MAPPING_FILE_ID'))

 

session = None

 

 

# Log the Mapping File ID. (test)

 

logger = fmeobjects.FMELogFile()

 

logger.logMessageString(mappingFileId, fmeobjects.FME_WARN)

 

logger = None

 

-----

 

 

A global FME object should be released explicitly by assigning None to prevent this warning.

 

"Warning: not all FMESessions that were created were destroyed before shutdown. This may cause instability"

 

But it seems not to be essential in FME 2014. Maybe improved? (not confirmed)

 

 

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

1 reply

takashi
Celebrity
  • Best Answer
  • March 4, 2014
Hi George,

 

 

I was able to get the Mapping File ID with this script.

 

It's not described in official documentations. There might be simpler way.

 

-----

 

# Startup Python Script Example: Get Mapping File ID

 

import fmeobjects

 

 

# Get Mapping File ID via FMESession object.

 

# Mapping File ID will be returned as a list of strings (words).

 

session = fmeobjects.FMESession()

 

mappingFileId = ' '.join(session.getSettings('MAPPING_FILE_ID'))

 

session = None

 

 

# Log the Mapping File ID. (test)

 

logger = fmeobjects.FMELogFile()

 

logger.logMessageString(mappingFileId, fmeobjects.FME_WARN)

 

logger = None

 

-----

 

 

A global FME object should be released explicitly by assigning None to prevent this warning.

 

"Warning: not all FMESessions that were created were destroyed before shutdown. This may cause instability"

 

But it seems not to be essential in FME 2014. Maybe improved? (not confirmed)

 

 

Takashi