<?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>idea Add support for pathlib.Path objects to arcpy in Python Ideas</title>
    <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idi-p/933118</link>
    <description>&lt;P&gt;&lt;A href="https://docs.python.org/3/library/pathlib.html" target="_blank" rel="noopener"&gt;pathlib&lt;/A&gt;&amp;nbsp;seems to be the preferred method for working with system paths in Python 3. We've started using it in place of `os.path` in our office recently and really like it. However, we've run into problems with using it with arcpy. For example:&lt;/P&gt;&lt;PRE&gt;workspace = pathlib.Path('C:\some path') \ 'anotherfolder' \ 'connection.sde'
with arcpy.EnvManager(workspace=workspace):
    pass‍‍‍‍‍‍&lt;/PRE&gt;&lt;P&gt;Throws this error: "RuntimeError: Object: Error in accessing environment &amp;lt;workspace&amp;gt;"&lt;/P&gt;&lt;P&gt;To work around this, we end up wrapping all of our Path object with str(). For example:&lt;/P&gt;&lt;PRE&gt;workspace = str(pathlib.Path('C:\some path') \ 'anotherfolder' \ 'connection.sde')
with arcpy.EnvManager(workspace=workspace):
    pass‍‍‍‍‍‍‍‍‍&lt;/PRE&gt;&lt;P&gt;It would be great if arcpy (Pro version) handled these Path objects natively!&lt;/P&gt;</description>
    <pubDate>Mon, 28 Jun 2021 20:30:33 GMT</pubDate>
    <dc:creator>ScottDavis</dc:creator>
    <dc:date>2021-06-28T20:30:33Z</dc:date>
    <item>
      <title>Add support for pathlib.Path objects to arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idi-p/933118</link>
      <description>&lt;P&gt;&lt;A href="https://docs.python.org/3/library/pathlib.html" target="_blank" rel="noopener"&gt;pathlib&lt;/A&gt;&amp;nbsp;seems to be the preferred method for working with system paths in Python 3. We've started using it in place of `os.path` in our office recently and really like it. However, we've run into problems with using it with arcpy. For example:&lt;/P&gt;&lt;PRE&gt;workspace = pathlib.Path('C:\some path') \ 'anotherfolder' \ 'connection.sde'
with arcpy.EnvManager(workspace=workspace):
    pass‍‍‍‍‍‍&lt;/PRE&gt;&lt;P&gt;Throws this error: "RuntimeError: Object: Error in accessing environment &amp;lt;workspace&amp;gt;"&lt;/P&gt;&lt;P&gt;To work around this, we end up wrapping all of our Path object with str(). For example:&lt;/P&gt;&lt;PRE&gt;workspace = str(pathlib.Path('C:\some path') \ 'anotherfolder' \ 'connection.sde')
with arcpy.EnvManager(workspace=workspace):
    pass‍‍‍‍‍‍‍‍‍&lt;/PRE&gt;&lt;P&gt;It would be great if arcpy (Pro version) handled these Path objects natively!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jun 2021 20:30:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idi-p/933118</guid>
      <dc:creator>ScottDavis</dc:creator>
      <dc:date>2021-06-28T20:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for pathlib.Path objects to arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/933119#M64</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This would be much appreciated. Going into Python 3 we want to make good use of the new stuff like Pathlib and f-strings.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2020 08:16:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/933119#M64</guid>
      <dc:creator>GISTeam4</dc:creator>
      <dc:date>2020-04-15T08:16:34Z</dc:date>
    </item>
    <item>
      <title>ArcPy tools should accept pathlib Paths</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1071421#M179</link>
      <description>&lt;P&gt;The pathlib library was included with the standard library as of 3.4.&amp;nbsp; There has been a general push towards these object-orientated paths as they provide immense improvements to the standard os library tools.&amp;nbsp; I've found most tools (i.e. all the ones I've worked with) do not support Path objects and force me to cast them to string prior to executing the tool.&amp;nbsp; I believe the tools should handle this casting implicitly so the end user can use Path objects or string representations of paths without conflict.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:44:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1071421#M179</guid>
      <dc:creator>chrismartinEsri</dc:creator>
      <dc:date>2021-06-23T12:44:33Z</dc:date>
    </item>
    <item>
      <title>Update arcpy cursors to work with paths constructed with pathlib objects</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1072307#M66</link>
      <description>&lt;P&gt;When using a path created from pathlib, arcpy.da.SearchCursor() returns&lt;/P&gt;&lt;P&gt;RuntimeError: 'in_table' is not a table or a featureclass&lt;/P&gt;&lt;P&gt;If the path is formatted with str() it works fine. Hopefully there's a way the cursor, and anything else that's relevant, can accept native objects from pathlib. Please see this relevant post&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-questions/using-pathlib-with-searchcursor/m-p/1072120/thread-id/61479#M61482" target="_self"&gt;Using pathlib with SearchCursor&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 20:47:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1072307#M66</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-06-24T20:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Update arcpy cursors to work with paths constructed with pathlib objects</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1072325#M67</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/191789"&gt;@BlakeTerhune&lt;/a&gt;&amp;nbsp;- having read you other post earlier, what is the advantage of pathlib?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 21:14:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1072325#M67</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-06-24T21:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Update arcpy cursors to work with paths constructed with pathlib objects</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1072330#M68</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3374"&gt;@JoeBorgione&lt;/a&gt;&amp;nbsp;I found a nice summary &lt;A href="https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/" target="_self"&gt;here&lt;/A&gt;. Also see the &lt;A href="https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module" target="_self"&gt;official documentation&lt;/A&gt; that compares the path related tools from os module.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 21:18:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1072330#M68</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-06-24T21:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy tools should accept pathlib Paths</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1079490#M180</link>
      <description>&lt;P&gt;This is a related idea from customers:&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idi-p/933118" target="_blank"&gt;https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idi-p/933118&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 22:28:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1079490#M180</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2021-07-15T22:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy tools should accept pathlib Paths - Status changed to: Under Consideration</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1088754#M181</link>
      <description>&lt;P&gt;I agree that working with pathlib paths is a much nicer experience than plain strings and os.path anipulations. We are considering this work, and I will link to this in our internal issue, Python #1795. We estimate this to be a larger change, because of the number of different places that we currently explicitly pass only strings and expect the objects to be strings without further inspection. I think it also begs the question of getting pathlib objects back out where available, which is another level to this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 02:59:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1088754#M181</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2021-08-13T02:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy tools should accept pathlib Paths</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1088818#M182</link>
      <description>&lt;P&gt;Good update&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/89710"&gt;@ShaunWalbridge&lt;/a&gt;&amp;nbsp;Given the status update on this one, could you or&amp;nbsp;@Anonymous User&amp;nbsp;update the &lt;A href="https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idi-p/933118" target="_blank" rel="noopener"&gt;customer idea&lt;/A&gt; to Under Consideration?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 12:25:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1088818#M182</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2021-08-13T12:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for pathlib.Path objects to arcpy - Status changed to: Under Consideration</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1089047#M75</link>
      <description>&lt;P&gt;Working with pathlib paths is a much nicer experience than plain strings and os.path anipulations. We are considering this work, but do estimate this to be a larger change, because of the number of different places that we currently explicitly pass only strings and expect the objects to be strings without further inspection.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 20:24:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1089047#M75</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2021-08-13T20:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy tools should accept pathlib Paths</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1089048#M183</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/129401"&gt;@KoryKramer&lt;/a&gt;OK posted it as under consideration on the public issue as well.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 20:24:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1089048#M183</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2021-08-13T20:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy tools should accept pathlib Paths</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1089049#M184</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;Thanks, Shaun!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 20:27:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1089049#M184</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2021-08-13T20:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for pathlib.Path objects to arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1089066#M76</link>
      <description>&lt;P&gt;Thank you for the consideration&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/89710"&gt;@ShaunWalbridge&lt;/a&gt;!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 22:22:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1089066#M76</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-08-13T22:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for pathlib.Path objects to arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1116711#M89</link>
      <description>&lt;P&gt;It seems to me that one (partial?) solution would be to wrap each function/method so that any passed object with a __fspath__ method is converted to the result of calling that method. This is essentially the same logic behind os.fspath(), which returns arbitrary strings unchanged, even if they couldn't possibly represent a path. Of course, it sequences of paths must also be covered, that could be accommodated, too. But if there are more complicated scenarios that I haven't anticipated, they may be harder to support.&lt;BR /&gt;&lt;BR /&gt;Incidentally, the basic approach I outlined is how I deal with this problem (at an abstract level) when generating scripts on the fly and passing them via propy.bat.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 00:48:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1116711#M89</guid>
      <dc:creator>EthanSchaefer</dc:creator>
      <dc:date>2021-11-15T00:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for pathlib.Path objects to arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1244566#M177</link>
      <description>&lt;P&gt;Is there any progress on this? It's quite annoying to be stuck with legacy path handling from Python 2, or always having to manually convert paths to strings, just because arcpy still does not support pathlib almost 3 years after this idea was posted.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 15:42:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1244566#M177</guid>
      <dc:creator>philnagel</dc:creator>
      <dc:date>2022-12-30T15:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for pathlib.Path objects to arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1478660#M316</link>
      <description>&lt;P&gt;I'd really like to upvote this as well. I want to use pathlib Path objects in my scripts as we use that as standard procedure for other file handling scripts. Having to break this pattern due to the arcpy library is really inconvenient.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2024 20:32:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1478660#M316</guid>
      <dc:creator>OliviaHughes</dc:creator>
      <dc:date>2024-05-24T20:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for pathlib.Path objects to arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1490653#M323</link>
      <description>&lt;P&gt;I agree with Olivia, any progress incorporating pathlib would be greatly appreciated. Maybe I am mistaken, but I think just being able to pass pathlib.Path types into parameter fields would be sufficient.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 15:38:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1490653#M323</guid>
      <dc:creator>subora_iastate</dc:creator>
      <dc:date>2024-06-12T15:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for pathlib.Path objects to arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1591529#M439</link>
      <description>&lt;P&gt;I get that pathlib&amp;nbsp;&lt;EM&gt;outputs&lt;/EM&gt; might be a naturally-expected addition to this, but given the apparent devtime required, perhaps it might be best to release this in stages?&amp;nbsp; Surely pathlib&amp;nbsp;&lt;EM&gt;inputs&lt;/EM&gt; could be achieved for all or most of arcpy in a minor version or two, rather than this three-year-and-counting wait?&lt;/P&gt;&lt;P&gt;Especially when one considers the lag time for many organizations between release and deployment of new versions, I shudder to think of this still being unavailable to me a decade from now.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 03:20:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1591529#M439</guid>
      <dc:creator>MErikReedAugusta</dc:creator>
      <dc:date>2025-03-04T03:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for pathlib.Path objects to arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1602990#M457</link>
      <description>&lt;P&gt;Pathlib inputs would be a great MVP for this.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2025 21:15:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1602990#M457</guid>
      <dc:creator>JordanCarmona</dc:creator>
      <dc:date>2025-04-04T21:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for pathlib.Path objects to arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1618321#M471</link>
      <description>&lt;P&gt;Does anybody know the status for this - it's a bit frustrating thay you always have to convert a Path to a dump string before parsing it to ArcPy? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 May 2025 12:34:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-support-for-pathlib-path-objects-to-arcpy/idc-p/1618321#M471</guid>
      <dc:creator>MortenBackNielsen</dc:creator>
      <dc:date>2025-05-26T12:34:13Z</dc:date>
    </item>
  </channel>
</rss>

