Skip to main content
Question

Python version error - what are my options

  • November 26, 2019
  • 3 replies
  • 51 views

bo
Contributor
Forum|alt.badge.img+8
  • Contributor

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 5in MF_Include_1574806112377
  File "<string>", line 4in 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

3 replies

sigtill
Contributor
Forum|alt.badge.img+24
  • Contributor
  • 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
Evangelist
  • 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+8
  • Author
  • Contributor
  • November 27, 2019
david_r wrote:

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!


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