AnsweredAssumed Answered

File Path Lists and arcpy.GetParameterAsText

Question asked by leftieant76 on Sep 18, 2016
Latest reply on Sep 18, 2016 by Dan_Patterson

This probably comes under the category of  'let me Google that for you', but anyway:


I'm trying to write an ArcToolbox tool using a Python script I've already created. The script relies on a list of files, of which I've set up in the toolbox parameters as type 'Any' and multivalue = Yes.


My issue is that if I use arcpy.GetParameterAsText, the variable returns a string, which can be converted to a list by .split(';'), but then the backslashes used in the file path do strange things to my output.


Try as I may, I cannot think of an easy way of converting '\' to '\\' to solve my issue.


I've tried using arcpy.GetParameter, but this does not suit my need, as this returns a list of geoprocessing objects, and I need to extract part of the file name for a subsequent step in my process. Unless there's an easy way to convert this GP object to a text name?


Feeling a little fragile after the weekend, and my brain is not comprehending this particular issue on a Monday! Please help!