<?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: Copy Raster Error in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/copy-raster-error/m-p/739262#M57181</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;UPDATE: Code randomly started working and then stopped again when it was almost done when I got the same error. I will just convert the last few .dat files by hand, but I would like to know possible causes for the weird behavior so that I can better understand python/arc. The only thing I changed was erasing the extra parameters in the copy raster call (only left input raster and output raster).&amp;nbsp; Anyone?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Nov 2013 23:39:18 GMT</pubDate>
    <dc:creator>MargaretWooten</dc:creator>
    <dc:date>2013-11-11T23:39:18Z</dc:date>
    <item>
      <title>Copy Raster Error</title>
      <link>https://community.esri.com/t5/python-questions/copy-raster-error/m-p/739261#M57180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm using CopyRaster to convert a bunch of .dat files to .tif in python, but keep getting the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\Users\mwooten3\Desktop\Projects\Terrestrial Ecology\Code\convert_dat2tif.py", line 27, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.CopyRaster_management(indat, outtif, "", "", "256", "NONE", "NONE", "", "NONE", "NONE")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 11034, in CopyRaster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (CopyRaster).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's a short code modified from the one exported from ArcMap Modelbuilder, meant to iterate through a set of folders and convert the .dat files to .tif. The process on one file works in ArcMap, but not in Python. I changed the paths to make sure there were no spaces, and also tried saving to a short filename. I even tried using the original script generated from modelbuilder without making changes and got the same error. I keep looking for careless errors but can't seem to find anything. Any ideas what is wrong or suggestions? My code is posted below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Maggie&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# convert_dat2tif.py
# Created on: 2013-11-11 14:07:05.00000
#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy
import glob
import os


path = 'D:\\MaggieData\\TE_Data\\Graphics\\'
datpath = path + 'Dats\\'
tifpath = path + 'Tifs\\'


for folder in glob.iglob(datpath + '*'): # dat folder contains folders classified data, extracted, etc.
&amp;nbsp;&amp;nbsp;&amp;nbsp; type_ = os.path.basename(folder) # type_refers to classified data, extracted, stack, total, or percent
&amp;nbsp;&amp;nbsp;&amp;nbsp; for indat in glob.iglob(folder + '\\*.dat'): # go through all dat files in type_ folders, set them equal to paths or indat files that need to be converted to tif
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outtif = tifpath + type_ + '\\' + os.path.basename(indat)[:-3] + 'tif' # output is tiffs folder // type_ name // + suffix of indat file (minus the dat extension) plus a .tif extension
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Processing %s ' %(indat)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Copy Raster-- does nothing but convert to tiff
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRaster_management(indat, outtif, "", "", "256", "NONE", "NONE", "", "NONE", "NONE")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:52:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-raster-error/m-p/739261#M57180</guid>
      <dc:creator>MargaretWooten</dc:creator>
      <dc:date>2021-12-12T16:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Raster Error</title>
      <link>https://community.esri.com/t5/python-questions/copy-raster-error/m-p/739262#M57181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;UPDATE: Code randomly started working and then stopped again when it was almost done when I got the same error. I will just convert the last few .dat files by hand, but I would like to know possible causes for the weird behavior so that I can better understand python/arc. The only thing I changed was erasing the extra parameters in the copy raster call (only left input raster and output raster).&amp;nbsp; Anyone?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Nov 2013 23:39:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-raster-error/m-p/739262#M57181</guid>
      <dc:creator>MargaretWooten</dc:creator>
      <dc:date>2013-11-11T23:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Raster Error</title>
      <link>https://community.esri.com/t5/python-questions/copy-raster-error/m-p/739263#M57182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Last addendum:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tried Copy Raster on the rest of my .dat files in ArcMap and it is no longer working again. Also tried using Resample in Management which also failed. I'm not sure what's going on or what is causing these operations to fail, but I've tried everything I can think of to no avail. Anyone have any clue as to what might be going on? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Looks like I'm going over to ENVI to see if I can't convert these files to tiffs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your time.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Nov 2013 00:01:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-raster-error/m-p/739263#M57182</guid>
      <dc:creator>MargaretWooten</dc:creator>
      <dc:date>2013-11-12T00:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Raster Error</title>
      <link>https://community.esri.com/t5/python-questions/copy-raster-error/m-p/739264#M57183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you sure these .dat files are actually rasters?&amp;nbsp; (I have never used/seen a .dat file extension for a raster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Process: Copy Raster-- does nothing but convert to tiff
arcpy.CopyRaster_management(indat, outtif, "", "", "256", "NONE", "NONE", "", "NONE", "NONE")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000094000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000094000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;CopyRaster_management &lt;/SPAN&gt;&lt;STRONG&gt;(in_raster&lt;/STRONG&gt;&lt;SPAN&gt;, out_rasterdataset, {config_keyword}, {background_value}, {nodata_value}, {onebit_to_eightbit}, {colormap_to_RGB}, {pixel_type}, {scale_pixel_value}, {RGB_to_Colormap})&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are passing in the .dat as the first parameter (which is expecting a raster) but I suspect you are not doing that.&amp;nbsp; Maybe I don't understand what are the .dat files.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:28:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-raster-error/m-p/739264#M57183</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-12T07:28:14Z</dc:date>
    </item>
  </channel>
</rss>

