Question

User Parameter value is invalid if ending in a backslash

  • 8 August 2017
  • 6 replies
  • 4 views

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

Badge

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

Badge +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.
Badge

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.

 

Badge +6
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.

 

 

Badge +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.
Userlevel 4

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