<?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: Error 999999 while renaming raster. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717977#M55641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I've tried that, still no good. I'm pretty sure I got it to work the very first time I tried it, but I have no idea whats different now.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can't rename anything twice in a row to the same name, only once.&amp;nbsp; That is what is different.&amp;nbsp; The first time no object had the name you were renaming to.&amp;nbsp; The second time an object already had that name and you tried to rename another object with the same name, resulting in a conflicting duplicate name.&amp;nbsp; After the first time you rename an object to something, you have to delete the object that has that name before you can rename another object with that name.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Jul 2013 20:40:23 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2013-07-15T20:40:23Z</dc:date>
    <item>
      <title>Error 999999 while renaming raster.</title>
      <link>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717974#M55638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I keep getting error 999999 while trying to rename a raster. The code is below. Any advice?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
for raster in arcpy.ListRasters():
&amp;nbsp;&amp;nbsp;&amp;nbsp; #raster_name_check= raster[40]
&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(raster)&amp;gt;=40:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # get the raster name and file extension
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileName,fileExtension = os.path.splitext(raster)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #fileNameParts = fileName.split('_')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compactFileName = fileName[7:12] + fileName[23:29]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRaster_management(raster, compactFileName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compactFileName2= fileName[7:12] + fileName[23:29] + fileName[34:38]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Rename_management(compactFileName,compactFileName2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raster_list.append(compactFileName2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster_list
&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(raster)&amp;lt;=40:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Skip"
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 19:39:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717974#M55638</guid>
      <dc:creator>ScottBarron</dc:creator>
      <dc:date>2013-07-15T19:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Error 999999 while renaming raster.</title>
      <link>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717975#M55639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;if the raster name is too long it wont work print out the name and ensure it is less that 13 characters&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 19:45:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717975#M55639</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2013-07-15T19:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error 999999 while renaming raster.</title>
      <link>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717976#M55640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've tried that, still no good. I'm pretty sure I got it to work the very first time I tried it, but I have no idea whats different now.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 20:03:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717976#M55640</guid>
      <dc:creator>ScottBarron</dc:creator>
      <dc:date>2013-07-15T20:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error 999999 while renaming raster.</title>
      <link>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717977#M55641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I've tried that, still no good. I'm pretty sure I got it to work the very first time I tried it, but I have no idea whats different now.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can't rename anything twice in a row to the same name, only once.&amp;nbsp; That is what is different.&amp;nbsp; The first time no object had the name you were renaming to.&amp;nbsp; The second time an object already had that name and you tried to rename another object with the same name, resulting in a conflicting duplicate name.&amp;nbsp; After the first time you rename an object to something, you have to delete the object that has that name before you can rename another object with that name.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 20:40:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717977#M55641</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-07-15T20:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Error 999999 while renaming raster.</title>
      <link>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717978#M55642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ESRI GRID format has a limit of 13 characters, but it appears you are using a different format (something with a file extension like a .tif or .img or something). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Make sure you don't have the file you are attempting to rename open in another application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is the raster format you are using and the new name you are trying to rename to?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 20:42:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717978#M55642</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2013-07-15T20:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Error 999999 while renaming raster.</title>
      <link>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717979#M55643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The problem is he ran the script once and created a copy of an object assigning it a name.&amp;nbsp; Then he ran the script again on the same original objects and tried to create another copy of that object with the name he had previously assigned to the first copy.&amp;nbsp; Two objects cannot share the same file name and the rename function ignores the overwrite outputs setting.&amp;nbsp; With Rename the second time you run a script to reuse a name, you must add a delete routine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anytime I configure a Rename script I actually have to run it 2 times to create a script that will run correctly from that point on.&amp;nbsp; First using just a rename, the second time deleting the previously renamed object and then renaming another copy with that name (the delete function made no sense during the first run, but it is needed during the second).&amp;nbsp; The third time and following the script needs no modification, since it will remove the existing object with a given name and then rename a new object to that name.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 20:50:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717979#M55643</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-07-15T20:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error 999999 while renaming raster.</title>
      <link>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717980#M55644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would normally put something like this in there so it only needs run once:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(compactFileName2):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(compactFileName2)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, keep in mind that if you are saving as a FGDB raster, you can't start the filename with a number or special character.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:44:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-999999-while-renaming-raster/m-p/717980#M55644</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-12T06:44:26Z</dc:date>
    </item>
  </channel>
</rss>

