<?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 Using pathlib with SearchCursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-pathlib-with-searchcursor/m-p/1072120#M61479</link>
    <description>&lt;P&gt;I'm trying to switch from using the os module to pathlib.Path for working with file paths. For some reason, when I construct the path to the feature class (or table) with Path, it fails with&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;RuntimeError: 'in_table' is not a table or a featureclass&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If I simply convert the path to string in the cursor using str(), it works fine. A print() of the path looks normal; not a weird object or something. I get the same behavior with a file geodatabase and Oracle 12c enterprise geodatabase. I also tried using Path.joinpath() instead of the shorthand / but had the same error.&lt;/P&gt;&lt;P&gt;Is there a different way I should be constructing paths?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from pathlib import Path

egdb_conn = r"C:\GISConnections\user@instance.sde"
fc_path = Path(egdb_conn) / "schema.tablename"

print(fc_path)
print(arcpy.Exists(fc_path))

with arcpy.da.SearchCursor(fc_path, ["OID@"]) as search_cursor:
    for row in search_cursor:
        print(row)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, I'm on ArcGIS Pro 2.8&lt;/P&gt;</description>
    <pubDate>Thu, 24 Jun 2021 16:53:28 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2021-06-24T16:53:28Z</dc:date>
    <item>
      <title>Using pathlib with SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/using-pathlib-with-searchcursor/m-p/1072120#M61479</link>
      <description>&lt;P&gt;I'm trying to switch from using the os module to pathlib.Path for working with file paths. For some reason, when I construct the path to the feature class (or table) with Path, it fails with&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;RuntimeError: 'in_table' is not a table or a featureclass&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If I simply convert the path to string in the cursor using str(), it works fine. A print() of the path looks normal; not a weird object or something. I get the same behavior with a file geodatabase and Oracle 12c enterprise geodatabase. I also tried using Path.joinpath() instead of the shorthand / but had the same error.&lt;/P&gt;&lt;P&gt;Is there a different way I should be constructing paths?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from pathlib import Path

egdb_conn = r"C:\GISConnections\user@instance.sde"
fc_path = Path(egdb_conn) / "schema.tablename"

print(fc_path)
print(arcpy.Exists(fc_path))

with arcpy.da.SearchCursor(fc_path, ["OID@"]) as search_cursor:
    for row in search_cursor:
        print(row)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, I'm on ArcGIS Pro 2.8&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 16:53:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-pathlib-with-searchcursor/m-p/1072120#M61479</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-06-24T16:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using pathlib with SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/using-pathlib-with-searchcursor/m-p/1072236#M61481</link>
      <description>&lt;P&gt;Not surprising, the ArcPy DA module was originally written before pathlib came around.&amp;nbsp; I am guessing Esri will view this as an Enhancement Request to support pathlib.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 19:16:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-pathlib-with-searchcursor/m-p/1072236#M61481</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-06-24T19:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using pathlib with SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/using-pathlib-with-searchcursor/m-p/1072239#M61482</link>
      <description>&lt;P&gt;It returns a different object type, print works since its __repr__ method returns a string&lt;/P&gt;&lt;P&gt;.... pathlib.WindowsPath&lt;/P&gt;&lt;P&gt;convert to string before arc'ing it&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 19:20:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-pathlib-with-searchcursor/m-p/1072239#M61482</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-06-24T19:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using pathlib with SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/using-pathlib-with-searchcursor/m-p/1072308#M61487</link>
      <description>&lt;P&gt;Thank you both for sharing your thoughts. I have created a new Python Idea.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-ideas/update-arcpy-cursors-to-work-with-paths-constructed-with-pathlib/idi-p/1072307/jump-to/first-unread-message" target="_blank"&gt;Update arcpy cursors to work with paths constructe... - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 20:48:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-pathlib-with-searchcursor/m-p/1072308#M61487</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-06-24T20:48:42Z</dc:date>
    </item>
  </channel>
</rss>

