Skip to main content
Question

Debug Python Scripted Selection


albinepro
Supporter
Forum|alt.badge.img+7

Im trying to implement some dynamic selection based on an API call response. So far I can build a package for scripted selection according to Dynamic choices using Scripted Selection - FME Packages SDK Guide
and debug in VS Code attaching to Workbench (Build a Hello World package - FME Packages SDK Guide).
The problem is that debugging is bound to running the translation and that is already late for the script I need to debug. The selection scripts are run when filling in the transformer parameters. I need to add breakpoints and inspect the execution of selection script (ScriptedSelectionCallback) during the API calls and browsing the object structure. Is there some setup to make this possible?
The final purpose is to get this into User parameter scripted selection in FME Flow. I understand it would work this way in scripted parameter selection as it is in the transformers.

3 replies

crutledge
Enthusiast
Forum|alt.badge.img+32
  • Enthusiast
  • April 28, 2025

Hi ​@albinepro 

I cannot help you with the python breakpoints. I struggled (and continue to learn more as this is complex) but ​@siennaatsafe provided an elegant solution when I asked a similar question regarding dynamic parameters for Flow: Scripted Selection List Choice or Dropdown Form vs Flow | Community

Hope that helps!


albinepro
Supporter
Forum|alt.badge.img+7
  • Author
  • Supporter
  • April 28, 2025
crutledge wrote:

Hi ​@albinepro 

I cannot help you with the python breakpoints. I struggled (and continue to learn more as this is complex) but ​@siennaatsafe provided an elegant solution when I asked a similar question regarding dynamic parameters for Flow: Scripted Selection List Choice or Dropdown Form vs Flow | Community

Hope that helps!

Thanks ​@crutledge,
so if I understand it right, it’s not possible to migrate dynamic scripted parameters to Flow app yet and recently it’s working just from FME Workbench. I’ll try the workaround by  ​@siennaatsafe  if I’m able to set it up in 2 steps to make sense.


siennaatsafe
Safer
Forum|alt.badge.img+10

Thanks for tagging me ​@crutledge!

Hi ​@albinepro

I’m not a Python expert myself but I did ask a developer for clarity on this. 

Using scripted selection parameters in FME Flow is impossible at the moment. I don’t expect movement on this front for a while, so far we haven’t seen sufficient motivation, but I would encourage you to make an Idea here to start gathering interest.

Sometime in the 25 release cycle we should see Dynamic Parameters in FME Flow. These would not be Python based but JSON and the values could from a URL or another workspace .This is very much under development at the moment so I cannot guarantee anything about the final functionality or when it will be released.

However, you can see a sneak peek in this webinar: https://fme.safe.com/webinars/ai-agents-made-simple-unleash-the-power-of-all-your-data-with-any-ai/ See 19:46 Dynamic Parameters a Sneak Peek. 

If this was a workspace that is just being run on Form, you could continue down the Python route. Here’s the breakdown from a developer: 

  • Scripted Selection parameters mainly work for FME Packages because the Python scripts are installed in well-known locations that FME’s Python interpreter can access easily. So if you're building a custom transformer as an FME Package, everything "just works" once it's installed.

  • Scripted Selection parameters can also be used in workspace User Parameters, but now you must manually manage the Python scripts (transport them with the workspace) so FME can find and execute them.

  • All of the above applies to FME Form. On FME Flow, Scripted Selection parameters are not supported — meaning parameters that need to run custom code will show up as basic text fields only.

Onto the debugging question the developer said:

The debugging steps should all still be the same, except for these steps in the guide:

Then set a breakpoint on the first line of code following debugpy.wait_for_client().Now, run a workspace with the DemoGreeter transformer, and notice how the translation blocks. Attach the debugger by running the “Python: Remote Attach” configuration. The debugger stops at the specified breakpoint.

Do not run the workspace, but instead click the ... for the Scripted Selection parameter. That will attach the debugger and break at the breakpoint set in the ScriptedSelectionCallback. Also, you may need to restart Workbench when making changes to the Python code because it will be loaded in memory. This is noted as a warning in https://docs.safe.com/fme/html/fpkg-sdk/hello-world-package/#installed-package-source-redirection with:

Python code may be cached in certain execution contexts, such as in transformer parameter dialogs. Code changes may not be reflected in those contexts until FME Workbench is restarted.


Please let me know if you have any questions!


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