Skip to main content
Solved

python scripted private parameter not parsed as code


Forum|alt.badge.img

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?

Best answer by david_r

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

View original
Did this help you find an answer to your question?

8 replies

david_r
Evangelist
  • Best Answer
  • August 8, 2018

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


Forum|alt.badge.img
  • Author
  • August 8, 2018
I am working on FME 2018.1 build 18520

 

 


Forum|alt.badge.img
  • August 8, 2018

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.


david_r
Evangelist
  • August 8, 2018
alex_chris wrote:
I am working on FME 2018.1 build 18520

 

 

Sounds like you should report this error to Safe support!

Forum|alt.badge.img
  • April 18, 2019

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.


david_r
Evangelist
  • April 18, 2019
ella_s wrote:

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.


david_r wrote:

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.


david_r
Evangelist
  • March 11, 2020
frederic.barras wrote:

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


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