<?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 Invalid Characters in Creating Feature Class in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74816#M6103</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to do a network analysis without altering the existing data, I am creating a new GDB that will then have the 3 feature classes I need created within and then the data appended to it. However, when I try to create the feature class in my script, I get an error saying invalid characters. I looked up the error but couldn't derive a solution. Any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;outLocation &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; copied_Geodatabase
fiberFC &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Fiber'&lt;/SPAN&gt;
fiberTemplate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Fiber Segments'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
fiber_geometry &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'POLYLINE'&lt;/SPAN&gt;


arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateFeatureclass_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outLocation&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fiberFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fiber_geometry&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fiberTemplate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:53:57 GMT</pubDate>
    <dc:creator>VishalShah2</dc:creator>
    <dc:date>2021-12-10T22:53:57Z</dc:date>
    <item>
      <title>Invalid Characters in Creating Feature Class</title>
      <link>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74816#M6103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to do a network analysis without altering the existing data, I am creating a new GDB that will then have the 3 feature classes I need created within and then the data appended to it. However, when I try to create the feature class in my script, I get an error saying invalid characters. I looked up the error but couldn't derive a solution. Any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;outLocation &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; copied_Geodatabase
fiberFC &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Fiber'&lt;/SPAN&gt;
fiberTemplate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Fiber Segments'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
fiber_geometry &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'POLYLINE'&lt;/SPAN&gt;


arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateFeatureclass_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outLocation&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fiberFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fiber_geometry&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fiberTemplate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:53:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74816#M6103</guid>
      <dc:creator>VishalShah2</dc:creator>
      <dc:date>2021-12-10T22:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Characters in Creating Feature Class</title>
      <link>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74817#M6104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That error usually means there's whitespace, a hyphen, something like that in the table name - strange error in this case though since "Fiber" should be valid.&amp;nbsp; Try using this function to validate your table name:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Edit: Posted the wrong link in my original post)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-functions/validatetablename.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-functions/validatetablename.htm"&gt;ValidateTableName—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2018 20:47:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74817#M6104</guid>
      <dc:creator>JamesMacKay3</dc:creator>
      <dc:date>2018-02-21T20:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Characters in Creating Feature Class</title>
      <link>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74818#M6105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error should tell you which line number in your script has the offending invalid characters.&amp;nbsp; With that said,it's a little unclear as where you are writing this new feature class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'out_path' argument for this tool is a path to a given workspace for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;out_path = r'C:\the\path\to\My.gdb'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps you could include your full script along with the full error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;CreateFeatureclass_management (out_path, out_name, {geometry_type}, {template}, {has_m}, {has_z}, 
{spatial_reference}, {config_keyword}, {spatial_grid_1}, {spatial_grid_2}, {spatial_grid_3})

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:53:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74818#M6105</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-10T22:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Characters in Creating Feature Class</title>
      <link>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74819#M6106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joe, so the error said it takes place where I am trying to create the feature class&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateFeatureclass_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outLocation&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fiberFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fiber_geometry&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fiberTemplate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;where outLocation is a geodatabase that is created earlier in my script (this part works). It's the create feature class that is giving me issues. Of course my GDB does not have any spaces.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2018 21:05:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74819#M6106</guid>
      <dc:creator>VishalShah2</dc:creator>
      <dc:date>2018-02-21T21:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Characters in Creating Feature Class</title>
      <link>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74820#M6107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James, I saw this as a possible solution when I was researching this error before. Question though, do I have to add the validate function within my script for every feature class being created?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2018 21:13:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74820#M6107</guid>
      <dc:creator>VishalShah2</dc:creator>
      <dc:date>2018-02-21T21:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Characters in Creating Feature Class</title>
      <link>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74821#M6108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you'll need to call it for each unique feature class name.&amp;nbsp; You may also want to have a look at the "Validate Field Name" function, since you're using a template as part of your feature class creation.&amp;nbsp; You could be pulling in a field that has a name that's valid in one type of workspace but invalid in another - for example, some field names may be valid in a File Geodatabase that aren't valid in SQL Server or in a Shapefile.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2018 21:19:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74821#M6108</guid>
      <dc:creator>JamesMacKay3</dc:creator>
      <dc:date>2018-02-21T21:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Characters in Creating Feature Class</title>
      <link>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74822#M6109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Like&amp;nbsp;James mentions your error problem seems weird.&amp;nbsp; I just ran the same basic thing in a python window in ArcMap with a couple of tweeks and it worked for me...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For out_name I used a single quoted name instead of a variable :&amp;nbsp; 'NewFeatureClass'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For template&amp;nbsp;I didn't use a layer from the listLayers as you did, but rather set a variable to an actual path:&lt;/P&gt;&lt;P&gt;out_location = r'C:\users\JBorgione\Test.gdb'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateFeatureclass_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;out_location&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'NewFeatureCass'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fc_geometry&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fcTemplate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2018 21:23:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74822#M6109</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2018-02-21T21:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Characters in Creating Feature Class</title>
      <link>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74823#M6110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;James, so I figured out what I was doing wrong. So originally in my script I have a template GDB where that is copied to create another workplace GDB. After that, I attempt to append the data. Originally my tempalte GDB was corrupt and had no data in it and thus I went the step of creating feature classes within the copied GDB, thus this thread being created. However, now that my GDB is not corrupt, I don't have to create new features in the GDB. Thanks for the help!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2018 14:58:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invalid-characters-in-creating-feature-class/m-p/74823#M6110</guid>
      <dc:creator>VishalShah2</dc:creator>
      <dc:date>2018-02-22T14:58:12Z</dc:date>
    </item>
  </channel>
</rss>

