Skip to main content
Solved

Escape @ in pythonCaller

  • February 22, 2024
  • 2 replies
  • 61 views

sunsilk11
Contributor
Forum|alt.badge.img+6

Hi I am using FME Form 2021

I am passing a ArcGIS portal login (including domain) as a user parameter

e.g. username@sss.co.uk

 

When I try to get the value in pythonCaller

portalAdmin = str(FME_MacroValues['ArcGIS_Portal_UserName']).strip() 

It is coming as

username<at>sss.co.uk

I am unable to use this to login to my portal in pythonCaller.

 

Any idea how to escape the @ sign ?

Best answer by david_r

Try this:

import fmeobjects

username = str(FME_MacroValues['ArcGIS_Portal_UserName'])
username_parsed = fmeobjects.FMESession().decodeFromFMEParsableText(username)
portalAdmin = username_parsed.strip()

Documentation: https://docs.safe.com/fme/html/fmepython/api/fmeobjects/_utilities/fmeobjects.FMESession.decodeFromFMEParsableText.html#fmeobjects.FMESession.decodeFromFMEParsableText

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.

2 replies

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • February 22, 2024

What type of user parameter, and how is it configured? I was able to recreate your issue using a Text parameter with the HTML editor syntax. However, with a Plain Text (Uniline) syntax the @ symbol comes through as expected.

 


david_r
Celebrity
  • Best Answer
  • February 22, 2024

Try this:

import fmeobjects

username = str(FME_MacroValues['ArcGIS_Portal_UserName'])
username_parsed = fmeobjects.FMESession().decodeFromFMEParsableText(username)
portalAdmin = username_parsed.strip()

Documentation: https://docs.safe.com/fme/html/fmepython/api/fmeobjects/_utilities/fmeobjects.FMESession.decodeFromFMEParsableText.html#fmeobjects.FMESession.decodeFromFMEParsableText