<?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 Re: memory workspace and alter Field ERROR 000664 bug. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121274#M63100</link>
    <description>&lt;P&gt;According to &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/alter-field-properties.htm" target="_blank" rel="noopener"&gt;Alter Field (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;When using in memory feature classes or tables, renaming the&amp;nbsp;ObjectID,&amp;nbsp;Shape, or other required fields such as those found in network analysis layers can result in corrupted data or unexpected behavior.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Not sure if that directly applies to your situation, but it seems close enough to point out in case you were not already aware.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;:&amp;nbsp; I just did a quick test using a basic feature class (nothing special like network analysis), and got:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcgisscripting.ExecuteError: ERROR 000664: Invalid input: The type of dataset is not supported.
Failed to execute (AlterField).&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It appears the newer memory workspace does not support altering fields.&lt;/P&gt;</description>
    <pubDate>Tue, 30 Nov 2021 15:56:54 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2021-11-30T15:56:54Z</dc:date>
    <item>
      <title>memory workspace and alter Field ERROR 000664 bug.</title>
      <link>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121258#M63099</link>
      <description>&lt;P&gt;Updating some scripts from 2.7 to 3 in hopes of solving a memory leak that is causing an 'Out of memory' error when rebuilding a small (~50k edges) Network dataset in our maintenance tasks.&amp;nbsp; I didn't see anything mentioning this in the bug reports so thought I'd post it here if anyone else experienced this.&lt;/P&gt;&lt;P&gt;I started using the legacy 'in_memory' space but it looks like the CopyFeatures tool cannot output to it.&amp;nbsp; I need to create copies of data in order to modify fields and other data without changing the underlying data. I verified that nothing is written by testing with arcpy's get count and the feature count = 0. Changed to 'memory' workspace and the count is right.&lt;/P&gt;&lt;P&gt;The script continues up to where I need to alter a few field names.&amp;nbsp; Using the memory workspace for the outputs, the script fails with ERROR 000664: Invalid input: The type of dataset is not supported.&amp;nbsp; If I revert back to 'in_memory', it alters the field just fine.&lt;/P&gt;&lt;P&gt;A simple sample:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;in_memory = "memory\\" # "in_memory"
env.workspace = in_memory

adrSelection = arcpy.MakeFeatureLayer_management(anyfc, 'tNR', "symbol = 319")

adr = arcpy.CopyFeatures_management(adrSelection, os.path.join(env.workspace, 'tmpLyr'))

for flds in [('st_type', 'street_type'), ('use', 'use update')]:
    arcpy.management.AlterField(adr, flds[0], flds[1], flds[1])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 15:16:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121258#M63099</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-11-30T15:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: memory workspace and alter Field ERROR 000664 bug.</title>
      <link>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121274#M63100</link>
      <description>&lt;P&gt;According to &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/alter-field-properties.htm" target="_blank" rel="noopener"&gt;Alter Field (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;When using in memory feature classes or tables, renaming the&amp;nbsp;ObjectID,&amp;nbsp;Shape, or other required fields such as those found in network analysis layers can result in corrupted data or unexpected behavior.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Not sure if that directly applies to your situation, but it seems close enough to point out in case you were not already aware.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;:&amp;nbsp; I just did a quick test using a basic feature class (nothing special like network analysis), and got:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcgisscripting.ExecuteError: ERROR 000664: Invalid input: The type of dataset is not supported.
Failed to execute (AlterField).&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It appears the newer memory workspace does not support altering fields.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 15:56:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121274#M63100</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-11-30T15:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: memory workspace and alter Field ERROR 000664 bug.</title>
      <link>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121282#M63101</link>
      <description>&lt;P&gt;Thanks Josh,&lt;/P&gt;&lt;P&gt;I saw that in the docs, and I am not changing any of the required fields.&amp;nbsp; Just weird and a little frustrating at the same time that there seems to be issues with the in_memory and memory workspace compatibility with certain tools. I am about to apply the updates that Pro is alerting me to see if the issue persist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 16:07:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121282#M63101</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-11-30T16:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: memory workspace and alter Field ERROR 000664 bug.</title>
      <link>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121320#M63103</link>
      <description>&lt;P&gt;Historically, "in_memory" workspace was quite limited and Esri clearly stated that in-memory workspace wasn't a complete workspace, like a geodatabase.&amp;nbsp; That said, Esri has added a lot of functionality to the newer "memory" workspace, and it is close to being complete.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whether you are running into a defect or known limitation is unclear from the current documentation.&amp;nbsp; I suggest you open a case with Esri Support to get clarity and possibly log either a software or documentation defect.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 17:15:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121320#M63103</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-11-30T17:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: memory workspace and alter Field ERROR 000664 bug.</title>
      <link>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121338#M63104</link>
      <description>&lt;P&gt;Good points.&amp;nbsp; There is also the project's scratch workspace and the Delete tool, for those than can manage a little extra time for writing/reading on machines with older disk hardware and/or limited memory.&amp;nbsp; Not sure where GPU is, or is going to fit into this in upcoming versions of Pro for some of the current slate of tools.&amp;nbsp; For example SA only supports a few tools but this will change&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/spatial-analyst/gpu-processing-with-spatial-analyst.htm" target="_blank"&gt;GPU processing with Spatial Analyst—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 17:49:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121338#M63104</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-11-30T17:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: memory workspace and alter Field ERROR 000664 bug.</title>
      <link>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121352#M63106</link>
      <description>&lt;P&gt;Thanks Josh,&lt;/P&gt;&lt;P&gt;I've ran into a few limitations with the in_memory before but for the most part it was awesome for 2.7 and let us do a lot of our nightly maintenance tasks without having to temporarily output to disk.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I finished applying the updates (now on 2.9.0) and the problem with altering the fields is still there so it looks like I'll open a case with ESRI.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 17:59:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121352#M63106</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-11-30T17:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: memory workspace and alter Field ERROR 000664 bug.</title>
      <link>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121687#M63113</link>
      <description>&lt;P&gt;I just saw your update- thank you for checking it on your system. I converted a lot of the alter fields to be remapped fields in fieldmappings, which shaved a few minutes off the processing time for some tasks, so that is nice.&amp;nbsp; I'll have to figure out how to change it in other processes that do not involve a geoprocess that uses a fieldmap.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Side note: I think it would be extremely helpful if there were more examples of using the FieldMappings/ FieldMap objects methods.&amp;nbsp; Showing the process of finding a field by name, then changing the output field name.&amp;nbsp; Stepping through the code with a debugger, managed to do it with:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;indx = fldMap.findFieldMapIndex('name')
mapToReplace = fldMap.getFieldMap(indx)

fldMap_name = mapToReplace.outputField
fldMap_name.name = 'new_name'
fldMap_name.aliasName = 'new_name'

mapToReplace.outputField = fldMap_name

fldMap.replaceFieldMap(indx, mapToReplace)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 14:28:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-workspace-and-alter-field-error-000664-bug/m-p/1121687#M63113</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-01T14:28:21Z</dc:date>
    </item>
  </channel>
</rss>

