<?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 sdf.spatial.to_featureset() weakref error in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1659359#M11742</link>
    <description>&lt;P&gt;using arcgis 2.4.1.&amp;nbsp; Developed this script a few months ago and didn't have this problem until testing it again this week, and it is now throwing this error when trying to create a featureset from an SEDF created by the GeoAccessor.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ValueError("&amp;lt;weakref at 0x000002874A68BA10; to 'ExtensionBlock' at 0x000002874C193DD0&amp;gt; is not in list")&lt;/LI-CODE&gt;&lt;P&gt;The script is over 2k lines and this problem just started happening after we republished the services with the related tables included.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lv_sdf = GeoAccessor.from_featureclass(lv_config['lv_scratch_fc_path'])
# perform column renaming, etc.

feat_set = lv_sdf.spatial.to_featureset() # to_featureset() is broken here.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Has anyone else come across this before?&lt;/P&gt;</description>
    <pubDate>Tue, 21 Oct 2025 16:30:34 GMT</pubDate>
    <dc:creator>jmk_307</dc:creator>
    <dc:date>2025-10-21T16:30:34Z</dc:date>
    <item>
      <title>sdf.spatial.to_featureset() weakref error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1659359#M11742</link>
      <description>&lt;P&gt;using arcgis 2.4.1.&amp;nbsp; Developed this script a few months ago and didn't have this problem until testing it again this week, and it is now throwing this error when trying to create a featureset from an SEDF created by the GeoAccessor.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ValueError("&amp;lt;weakref at 0x000002874A68BA10; to 'ExtensionBlock' at 0x000002874C193DD0&amp;gt; is not in list")&lt;/LI-CODE&gt;&lt;P&gt;The script is over 2k lines and this problem just started happening after we republished the services with the related tables included.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lv_sdf = GeoAccessor.from_featureclass(lv_config['lv_scratch_fc_path'])
# perform column renaming, etc.

feat_set = lv_sdf.spatial.to_featureset() # to_featureset() is broken here.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Has anyone else come across this before?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 16:30:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1659359#M11742</guid>
      <dc:creator>jmk_307</dc:creator>
      <dc:date>2025-10-21T16:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: sdf.spatial.to_featureset() weakref error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1661537#M11762</link>
      <description>&lt;P&gt;I'm getting the same error in a similar situation using spatial.to_featureclass(). Script worked about 6 months ago but when I tried to run it this week it threw that error.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2025 20:09:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1661537#M11762</guid>
      <dc:creator>Andrew_McClary</dc:creator>
      <dc:date>2025-10-28T20:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: sdf.spatial.to_featureset() weakref error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1662016#M11763</link>
      <description>&lt;P&gt;Doesn't look like there is much traction on this but glad to know that I'm not alone and more likely a bug than code syntax. Band aid workaround is to iterate over the dataframe and construct the list of feature dictionaries. This takes either featureclass (geometry) or table (no geometry):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        def convert_to_featureset(lv_sdf):
            """
            helper function to convert the sdf to a list of features for the edit_feature.

            .to_featureset() here is causing &amp;lt;weakref at 0x0000011EC04640E0; to 'ExtensionBlock' at 0x0000011EC636CCB0&amp;gt;
            errors in arcgis 2.4.1. should be tested in newer versions of arcgis and the be re-evaluated.
            """

            features = []

            if "SHAPE" in [col for col in lv_sdf.columns]:
                for idx, row in lv_sdf.iterrows():
                    # Append to features list
                    features.append({
                        "attributes": {
                            key: value
                            for key, value in row.items()
                            if key != 'SHAPE' and pd.notna(value)
                        },
                        "geometry": row['SHAPE'].JSON if row['SHAPE'] else None})
            else:
                for idx, row in lv_sdf.iterrows():
                    # Append to features list
                    features.append({"attributes": {key: value for key, value in row.items() if pd.notna(value)}})

            return features&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Oct 2025 18:33:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1662016#M11763</guid>
      <dc:creator>jmk_307</dc:creator>
      <dc:date>2025-10-29T18:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: sdf.spatial.to_featureset() weakref error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1667089#M11784</link>
      <description>&lt;P&gt;I experienced the same problem with a script I wrote a couple of months that didn't work when I tried it this week.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this line in my code:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;pd.options.mode.copy_on_write = True &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and when I removed it, the script started working again.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope this help&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Nov 2025 12:35:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1667089#M11784</guid>
      <dc:creator>so_1789</dc:creator>
      <dc:date>2025-11-19T12:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: sdf.spatial.to_featureset() weakref error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1669400#M11800</link>
      <description>&lt;P&gt;I am using that line in the scripts as well.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;pd.options.mode.copy_on_write = True&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope esri is looking at this error because &lt;A href="https://pandas.pydata.org/docs/user_guide/copy_on_write.html" target="_blank" rel="noopener"&gt;pandas is making it default&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;H2&gt;Migrating to Copy-on-Write&lt;/H2&gt;&lt;P&gt;Copy-on-Write will be the default and only mode in pandas 3.0. This means that users need to migrate their code to be compliant with CoW rules.&lt;/P&gt;&lt;P&gt;The default mode in pandas will raise warnings for certain cases that will actively change behavior and thus change user intended behavior.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 01 Dec 2025 18:24:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/sdf-spatial-to-featureset-weakref-error/m-p/1669400#M11800</guid>
      <dc:creator>jmk_307</dc:creator>
      <dc:date>2025-12-01T18:24:39Z</dc:date>
    </item>
  </channel>
</rss>

