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
  • 6 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
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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
Contributor
Forum|alt.badge.img+21
  • Contributor
  • 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

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