Skip to main content
Question

User Parameter value is invalid if ending in a backslash


If a User Parameter ends in a backslash - such as a Windows path, then accessing that value in a PythonCaller results in extra text. Example: if a User Parameter called foldername has the value:

frog\\

then using fme.macroValues['foldername'] or FME_MacroValues['foldername'] in a PythonCaller returns:

frog GUI OPTIONAL TEXT foldername Folder name:

6 replies

jneujens
Forum|alt.badge.img
  • August 9, 2017

I got the same issue. It just changes to the 'frog\\' to that whole string. I am curious about the how and why?


trentatsafe
Safer
Forum|alt.badge.img+6

Hello @rsliva and @jneujens

Are you able to provide us with a few more details:

 

 

What is the User parameter definition?

 

Along with the PythonCaller code, you are running to see the results. This appears to be a possible bug and as such, I would file a PR once I verify the behaviour.

jneujens
Forum|alt.badge.img
  • August 9, 2017
trentatsafe wrote:

Hello @rsliva and @jneujens

Are you able to provide us with a few more details:

 

 

What is the User parameter definition?

 

Along with the PythonCaller code, you are running to see the results. This appears to be a possible bug and as such, I would file a PR once I verify the behaviour.
parameter-backslash.fmw

 

 

This is my example workspace, just something really quick to check @rsliva's question.

 


trentatsafe
Safer
Forum|alt.badge.img+6
jneujens wrote:
parameter-backslash.fmw

 

 

This is my example workspace, just something really quick to check @rsliva's question.

 

Thank you for the workspace. I will file a PR for this and try to get some feedback regarding this.

 

 


trentatsafe
Safer
Forum|alt.badge.img+6

Hello @rsliva and @jneujens

 

 

I have found an existing PR pertaining to this, I have attached this posting to the PR, so that if any updates occur regarding a possible fix this question will be updated.

 

 

In the meantime, if dealing with a string that ends with a \\, it may be best to try another Parameter type such as 'Folder' or 'File Name'.

 

 

I hope this helps.

david_r
Evangelist
  • May 7, 2021

I just stumbled upon this old thread, I'll just add the following for those that are still affected by this issue.

Rather than writing:

fme.macroValues['foldername']

You can write the following, which should prevent FME from interfering with your code:

fme.macroValues.get('foldername')

 


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