Skip to main content
Question

Python version error - what are my options

  • November 26, 2019
  • 3 replies
  • 80 views

bo
Contributor
Forum|alt.badge.img+10
  • Contributor
  • 79 replies

I have an old but simple workspace with one private parameter defined as 

return FME_MacroValues['pEvent_Attributes'].replace(',',' ') + ' ' + FME_MacroValues['pEvent_Route_ID']

When I dug it up and run it under 2019.1.2.0 (20190829 - Build 19630 - linux-x64), it failed with the following msg:

Python version 3.6 loaded successfully
Traceback (most recent call last):
  File "<string>", line 5, in MF_Include_1574806112377
  File "<string>", line 4, in ParamFunc
KeyError: 'LRS_EventMerger_pEvent_Attributes'
INCLUDE -- failed to evaluate Python script `def ParamFunc():

  return 
FME_MacroValues[FME_MacroValues['LRS_EventMerger_WORKSPACE_NAME'] + '_' +
 'pEvent_Attributes'].replace(',',' ') + ' ' + 
FME_MacroValues[FME_MacroValues['LRS_EventMerger_WORKSPACE_NAME'] + '_' +
 'pEvent_Route_ID']
value = ParamFunc()
macroName = FME_MacroValues['LRS_EventMerger_WORKSPACE_NAME'] + '_pAttributes_Merge'
if value == None:
  return { macroName : u'' }
else:
  import six
  try:
    value = six.text_type(value)
  except UnicodeDecodeError:
    value = six.text_type(value, 'utf-8')
  return { macroName : value }
'
Program Terminating
Translation FAILED.

I would like to know how I may fix this with the 3.x Python instead of using Python 2.7  Thanks for any comments.

Bo

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.

3 replies

sigtill
Supporter
Forum|alt.badge.img+25
  • Supporter
  • 956 replies
  • November 27, 2019

Have you tried for instance:

https://www.pythonconverter.com/

?

 

I`m sure some other Python-entusiasts might give a better answer :)


david_r
Celebrity
  • 8394 replies
  • November 27, 2019

The problem is that the dictionary FME_MacroValues does not know of a key called "LRS_EventMerger_pEvent_Attributes", I'm not sure it is tied to the Python version.

Is this inside a custom transformer, perhaps?


bo
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • 79 replies
  • November 27, 2019

The problem is that the dictionary FME_MacroValues does not know of a key called "LRS_EventMerger_pEvent_Attributes", I'm not sure it is tied to the Python version.

Is this inside a custom transformer, perhaps?

@david_r, you are right. It turned out that the parameter name was changed. This is NOT python related afterall!