<?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 ListFields Not Working for Feature Classes in Enterprise SDE in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056833#M61093</link>
    <description>&lt;P&gt;I have been running into a strange issue with a code I am working on and it only happens when I am working with data formatted like this.&amp;nbsp; This is from a script that uses a Multivalued Parameter. See below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fc = "'Database Connections\\Prod@GISdb.OSA.sde\\Prod.Water\\Prod.ControlValve';'Database Connections\\Prod@GISdb.OSA.sde\\Prod.Water\\Prod.wFitting';'Database Connections\\Prod@GISdb.OSA.sde\\Prod.Water\\Prod.wHydrant'"

fclist = fc.split(";")

for each in fclist:
    fieldnames = [f.name for f in arcpy.ListFields(each)]
    print fieldnames&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From this I get the error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Runtime error&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 2, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\__init__.py", line 1139, in ListFields&lt;BR /&gt;return gp.listFields(dataset, wild_card, field_type)&lt;BR /&gt;File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\geoprocessing\_base.py", line 346, in listFields&lt;BR /&gt;self._gp.ListFields(*gp_fixargs(args, True)))&lt;BR /&gt;IOError: "'Database Connections\Prod@GISdb.OSA.sde\Prod.Water\Prod.ControlValve'" does not exist&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am at a loss with this error as it appears quite often.&amp;nbsp; If anyone has any points how to avoid this error I would be extremely grateful!&lt;/P&gt;</description>
    <pubDate>Tue, 11 May 2021 19:26:59 GMT</pubDate>
    <dc:creator>EvanMyers1</dc:creator>
    <dc:date>2021-05-11T19:26:59Z</dc:date>
    <item>
      <title>ListFields Not Working for Feature Classes in Enterprise SDE</title>
      <link>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056833#M61093</link>
      <description>&lt;P&gt;I have been running into a strange issue with a code I am working on and it only happens when I am working with data formatted like this.&amp;nbsp; This is from a script that uses a Multivalued Parameter. See below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fc = "'Database Connections\\Prod@GISdb.OSA.sde\\Prod.Water\\Prod.ControlValve';'Database Connections\\Prod@GISdb.OSA.sde\\Prod.Water\\Prod.wFitting';'Database Connections\\Prod@GISdb.OSA.sde\\Prod.Water\\Prod.wHydrant'"

fclist = fc.split(";")

for each in fclist:
    fieldnames = [f.name for f in arcpy.ListFields(each)]
    print fieldnames&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From this I get the error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Runtime error&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 2, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\__init__.py", line 1139, in ListFields&lt;BR /&gt;return gp.listFields(dataset, wild_card, field_type)&lt;BR /&gt;File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\geoprocessing\_base.py", line 346, in listFields&lt;BR /&gt;self._gp.ListFields(*gp_fixargs(args, True)))&lt;BR /&gt;IOError: "'Database Connections\Prod@GISdb.OSA.sde\Prod.Water\Prod.ControlValve'" does not exist&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am at a loss with this error as it appears quite often.&amp;nbsp; If anyone has any points how to avoid this error I would be extremely grateful!&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 19:26:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056833#M61093</guid>
      <dc:creator>EvanMyers1</dc:creator>
      <dc:date>2021-05-11T19:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields Not Working for Feature Classes in Enterprise SDE</title>
      <link>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056848#M61094</link>
      <description>&lt;P&gt;You could use arcpy.describe and .exists to validate the connection file is valid.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 19:49:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056848#M61094</guid>
      <dc:creator>PhilLarkin1</dc:creator>
      <dc:date>2021-05-11T19:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields Not Working for Feature Classes in Enterprise SDE</title>
      <link>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056850#M61095</link>
      <description>&lt;P&gt;maybe some raw formatting on the strings&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fc = "r'Database Connections\\Prod@GISdb.OSA.sde\\Prod.Water\\Prod.ControlValve';r'Database Connections\\Prod@GISdb.OSA.sde\\Prod.Water\\Prod.wFitting';r'Database Connections\\Prod@GISdb.OSA.sde\\Prod.Water\\Prod.wHydrant'"

fclist = fc.split(";")

for each in fclist:
    print (each)
    fieldnames = [f.name for f in arcpy.ListFields(each)]
    print fieldnames&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 11 May 2021 19:50:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056850#M61095</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-05-11T19:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields Not Working for Feature Classes in Enterprise SDE</title>
      <link>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056851#M61096</link>
      <description>&lt;P&gt;Beyond not using paths that contain spaces, and punctuation (which can cause inconsistent issues).&lt;/P&gt;&lt;P&gt;Set your works space and after parsing the featureclass/feature/table names, do a final check to see if it "exists"&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.env.workspace = "c:/your_path/your.gdb"
# ------ does it exists
if arcpy.Exists("your_fc"):
    Do stuff&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 11 May 2021 19:50:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056851#M61096</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-05-11T19:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields Not Working for Feature Classes in Enterprise SDE</title>
      <link>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056865#M61097</link>
      <description>&lt;P&gt;It turns out it was the single quotes ( ' ) around each file path that was giving me issues.&amp;nbsp; Never knew those would prevent arcpy.Describe and arcpy.ListFields from working&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":dizzy_face:"&gt;😵&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 20:11:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-not-working-for-feature-classes-in/m-p/1056865#M61097</guid>
      <dc:creator>EvanMyers1</dc:creator>
      <dc:date>2021-05-11T20:11:39Z</dc:date>
    </item>
  </channel>
</rss>

