<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python Script Help - Spaces in filename in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121041#M9469</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's because arcpy is wrapping single quotes around the file path.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;print repr(Layer) &amp;gt;&amp;gt;&amp;gt; u"'C:\\WorkSpace\\test workspace\\test.shp'"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works:&lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, os&amp;nbsp; #Read input parameters from script tool LayersList = arcpy.GetParameterAsText(0).split(";")&amp;nbsp; # Process: Add Field for Layer in LayersList: &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(repr(Layer)) &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(Layer.strip("'"), "DUP", "DOUBLE", 9, "", "", "Dup", "NULLABLE")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 May 2012 23:07:47 GMT</pubDate>
    <dc:creator>Luke_Pinner</dc:creator>
    <dc:date>2012-05-23T23:07:47Z</dc:date>
    <item>
      <title>Python Script Help - Spaces in filename</title>
      <link>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121036#M9464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please can somebody provide some advice?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the code below in a script to add a field to multiple shapefiles, however when the filename or file location contains spaces it does not work. I get the error&amp;nbsp; message "Input Table: xxxxx does not exist or is not supported"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think it must have something to do with the LayersList = string.split(arcpy.GetParameterAsText(0),";") line, but as i am new to Python i do not know how to correct it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It will be greatly appreciated if someone can help me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, os, string&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Read input parameters from script tool&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LayersList = string.split(arcpy.GetParameterAsText(0),";")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Add Field &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for Layer in LayersList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.AddField_management(Layer, "DUP", "DOUBLE", 9, "", "", "Dup", "NULLABLE")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 11:13:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121036#M9464</guid>
      <dc:creator>JamesMitchell</dc:creator>
      <dc:date>2012-05-23T11:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Help - Spaces in filename</title>
      <link>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121037#M9465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you ver much for the quick response.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried this and it still has the same error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The input parameters are shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 11:38:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121037#M9465</guid>
      <dc:creator>JamesMitchell</dc:creator>
      <dc:date>2012-05-23T11:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Help - Spaces in filename</title>
      <link>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121038#M9466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You should remove any spaces from your shapefile names.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 12:14:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121038#M9466</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-05-23T12:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Help - Spaces in filename</title>
      <link>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121039#M9467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The shapefiles are in different locations. When i save them into a folders without any spaces it works but when i move them into a folder location with spaces it no longer works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your input.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 12:17:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121039#M9467</guid>
      <dc:creator>JamesMitchell</dc:creator>
      <dc:date>2012-05-23T12:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Help - Spaces in filename</title>
      <link>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121040#M9468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Spaces in path names are not supported either for some functions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 12:26:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121040#M9468</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-05-23T12:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Help - Spaces in filename</title>
      <link>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121041#M9469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's because arcpy is wrapping single quotes around the file path.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;print repr(Layer) &amp;gt;&amp;gt;&amp;gt; u"'C:\\WorkSpace\\test workspace\\test.shp'"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works:&lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, os&amp;nbsp; #Read input parameters from script tool LayersList = arcpy.GetParameterAsText(0).split(";")&amp;nbsp; # Process: Add Field for Layer in LayersList: &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(repr(Layer)) &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(Layer.strip("'"), "DUP", "DOUBLE", 9, "", "", "Dup", "NULLABLE")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 23:07:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121041#M9469</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2012-05-23T23:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Help - Spaces in filename</title>
      <link>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121042#M9470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, that has corrected the issue. Thank you very much for the help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 08:04:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121042#M9470</guid>
      <dc:creator>JamesMitchell</dc:creator>
      <dc:date>2012-05-24T08:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Help - Spaces in filename</title>
      <link>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121043#M9471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you, this helped me figure out how to remove the extra quotes from my layer files that had spaces.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/94529-Layer-Invalid-Data-Source"&gt;http://forums.arcgis.com/threads/94529-Layer-Invalid-Data-Source&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 12:22:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-help-spaces-in-filename/m-p/121043#M9471</guid>
      <dc:creator>MaryM</dc:creator>
      <dc:date>2013-10-11T12:22:11Z</dc:date>
    </item>
  </channel>
</rss>

