Solved

python scripted private parameter not parsed as code

  • 8 August 2018
  • 8 replies
  • 6 views

Badge

I am trying to create a simple scripted parameter that creates a unique random id to insert into a DB for reporting purposes.

I am following step by step the example in the FME help pages:

https://knowledge.safe.com/articles/60080/python-scripted-parameters.html

I create a variable and I assign to it a UUID using the python module (interpreter 3.4+)

https://docs.python.org/3.4/library/uuid.html

import uuid
import fme

custom_uuid = str(uuid.uuid4())
# I tried both with and without conversion to string 
# custom_uuid = uuid.uuid4()

return custom_uuid

FME workbench does not read the parameter as the result of what is returned in the script, but reads the text of the script (adding some custom FME tags).

See from logger:

Logger: UUID is: import<space>uuid<lf>import<space>fme<lf><lf>custom_uuid<space>=<space>uuid.uuid4<openparen><closeparen><lf><lf>return<space>custom_uuid<lf>

what I am doing wrong for FME not reading the returned results from the script?

icon

Best answer by david_r 8 August 2018, 11:29

View original

8 replies

Userlevel 4

I've had this happen to me quite a few times, I cannot explain it otherwise than as a bug. Which FME version is this? I haven't had this issue for quite some time so I suspect it was fixed a few versions back.

The only fix I know of is to completely recreate the scripted parameter (you can copy/paste the code).

Badge
I am working on FME 2018.1 build 18520

 

 

Badge

Have you tried it without the "import fme" as this is not needed.

I have found with 2018 that python errors always get printed in that format instead of the pretty way it should be.

Userlevel 4
I am working on FME 2018.1 build 18520

 

 

Sounds like you should report this error to Safe support!
Badge

I had this issue on 2018.1.0.2 (Build 18547) too, creating a new parameter fixed it for me too.

I think it's caused by changing between parameter types: I can replicate it by adding a new text parameter, then editing that parameter to become a python script.

Userlevel 4

I had this issue on 2018.1.0.2 (Build 18547) too, creating a new parameter fixed it for me too.

I think it's caused by changing between parameter types: I can replicate it by adding a new text parameter, then editing that parameter to become a python script.

Interesting, thanks for sharing. I just tried with 2018.1.1.2 and 2019.0.0.0 and was not able to reproduce the issue. Let's hope it's been fixed.

Interesting, thanks for sharing. I just tried with 2018.1.1.2 and 2019.0.0.0 and was not able to reproduce the issue. Let's hope it's been fixed.

I just experienced it with FME 2019.2.3.1. The bug is still there. your fix is also still valid.

Userlevel 4

I just experienced it with FME 2019.2.3.1. The bug is still there. your fix is also still valid.

That's not good to hear. It would be very helpful if you could send a workspace that has this issue to Safe support for analysis.

Reply