<?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 arcpy.ListFields not working on feature service layer in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-listfields-not-working-on-feature-service/m-p/1227655#M65989</link>
    <description>&lt;P&gt;I use arcpy.ListFields to get editable fields.&amp;nbsp; It worked ok with the feature class from SDE.&amp;nbsp; Now I switched to use feature service on the portal and it gave out error like below:&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="3" color="#993366"&gt;&lt;SPAN class=""&gt;Traceback (most recent call last):
  File "C:\Users\LiY\Application\A_Production\Desktop\AGProPythonTest\PythonArcPyCode\CalculateLineLength.py", line 49, in &amp;lt;module&amp;gt;
    flds = [fld.name for fld in arcpy.ListFields(line_lyr.name) if fld.editable]
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 1166, in ListFields
    return gp.listFields(dataset, wild_card, field_type)
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 354, in listFields
    self._gp.ListFields(*gp_fixargs(args, True)))
OSError: "&lt;STRONG&gt;DrainagePipe&lt;/STRONG&gt;" does not exist&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;DrainagePipe is the layer name.&amp;nbsp; The code is this:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993366"&gt;flds = [fld.name for fld in arcpy.ListFields(line_lyr.name) if fld.editable]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I read the help document and it does not say anything about not working on feature service.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Nov 2022 20:27:25 GMT</pubDate>
    <dc:creator>YinghongLi1</dc:creator>
    <dc:date>2022-11-01T20:27:25Z</dc:date>
    <item>
      <title>arcpy.ListFields not working on feature service layer</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listfields-not-working-on-feature-service/m-p/1227655#M65989</link>
      <description>&lt;P&gt;I use arcpy.ListFields to get editable fields.&amp;nbsp; It worked ok with the feature class from SDE.&amp;nbsp; Now I switched to use feature service on the portal and it gave out error like below:&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="3" color="#993366"&gt;&lt;SPAN class=""&gt;Traceback (most recent call last):
  File "C:\Users\LiY\Application\A_Production\Desktop\AGProPythonTest\PythonArcPyCode\CalculateLineLength.py", line 49, in &amp;lt;module&amp;gt;
    flds = [fld.name for fld in arcpy.ListFields(line_lyr.name) if fld.editable]
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 1166, in ListFields
    return gp.listFields(dataset, wild_card, field_type)
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 354, in listFields
    self._gp.ListFields(*gp_fixargs(args, True)))
OSError: "&lt;STRONG&gt;DrainagePipe&lt;/STRONG&gt;" does not exist&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;DrainagePipe is the layer name.&amp;nbsp; The code is this:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993366"&gt;flds = [fld.name for fld in arcpy.ListFields(line_lyr.name) if fld.editable]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I read the help document and it does not say anything about not working on feature service.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 20:27:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listfields-not-working-on-feature-service/m-p/1227655#M65989</guid>
      <dc:creator>YinghongLi1</dc:creator>
      <dc:date>2022-11-01T20:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ListFields not working on feature service layer</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listfields-not-working-on-feature-service/m-p/1227709#M65991</link>
      <description>&lt;P&gt;Perhaps it doesn't work on a layer?&amp;nbsp; Try to run it against the layer's datasource. Something like this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;flds = [fld.name for fld in arcpy.ListFields(line_lyr.dataSource) if fld.editable]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 22:06:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listfields-not-working-on-feature-service/m-p/1227709#M65991</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2022-11-01T22:06:50Z</dc:date>
    </item>
  </channel>
</rss>

