I don't know what I'm doing wrong. I always get the error 000865 when using arcpy.ASCIIToRaster_conversion. I'm new and do not have much Python experience right now – so sorry for that.

>>> import arcpy
import os
from arcpy import env
env.workspace = r"D:\Julia_T\projekt\erste_schritte\dritter_tag_python\testdaten"

#folder to list
ascFileList = arcpy.ListFiles("*.asc")

for ascFile in ascFileList:
# geoprocessing steps
ascFileName = os.path.splitext(ascFile)[0]
# define the output file
rastFile = ascFileName + "_output.img"
# run the tool
arcpy.ASCIIToRaster_conversion(ascFile,rastFile, "INTEGER")

Runtime error Traceback (most recent call last): File "", line 15, in File "c:\programme\arcgis\desktop10.2\arcpy\arcpy\conversion.py", line 2193, in ASCIIToRaster raise e ExecuteError: ERROR 000865: Eingabe-ASCII-Raster-Datei: 2001002_cloud_free.asc ist nicht vorhanden.

Do I have to use the CatalogPath? I'm working with ArcMap 10.2.1. Thanks

  • Well your error is that the raster is not present. Does ` 2001002_cloud_free.asc` actually exist? It is a valid file that is recognized by Arcmap? – Paul Jul 23 '14 at 14:03
  • Take a look here. Could be a weird bug. – Paul Jul 23 '14 at 14:07
  • The steps under the for loop need to be indented -- is it correct in your script? (Often pasting code into Questions loses spaces.) – Erica Jul 23 '14 at 14:09
  • Yes, it in the script. I gonna try to fix it tomorrow. – Nora Jul 23 '14 at 19:31

The ASCIIToRaster tool is not interpreting the file names correctly, despite you setting the workspace environment. You need to include the full path, so in your case your line should be:

arcpy.ASCIIToRaster_conversion(env.workspace + "\\" + ascFile, env.workspace + "\\" + rastFile, "INTEGER")

Also as @Erica says you should get into the habit of placing print statements in your code to see the actual value of the variables.


Check whether the raster exists by using a print statement, e.g.

for ascFile in ascFileList:
    print ascFile

If that prints a list of .asc files, try rebooting.

If that doesn't work, check that the ASCII file will convert properly by testing just one (in a separate temporary script).

import arcpy
arcpy.ASCIIToRaster_conversion(r"c:\temp\2001002_cloud_free.asc",r"c:\temp\outp‌​ut.img", "INTEGER")

And use the full file path as Hornbydd describes:

for ascFile in ascFileList:
    # define the input file path
    ascFilePath = env.workspace + "\\" + ascFile
    # define the output file
    ascFileName = os.path.splitext(ascFile)[0]
    rastFilePath = env.workspace + "\\" + ascFileName + "_output.img"
    # run the tool
    arcpy.ASCIIToRaster_conversion(ascFile,rastFile, "INTEGER")
  • So I print every step, did restarted the system, but I still get the same ERROR while running the tool. I really don't know what to do. – Nora Jul 24 '14 at 8:03
  • 'print ascFileList #works for ascFile in ascFileList: # geoprocessing steps ascFileName = os.path.splitext (ascFile)[0] print ascFileName #works rastFile = ascFileName + "_output.img" print rastFile #works #run the tool arcpy.ASCIIToRaster_conversion (ascFile, rastFile, "INTEGER") #ERROR 000865' – Nora Jul 24 '14 at 8:11
  • @Nora Try (in a new script, perhaps) running the tool on just one raster with explicit declaration, e.g.: arcpy.ASCIIToRaster_conversion(r"c:\temp\2001002_cloud_free.asc",r"c:\temp\output.img", "INTEGER") – Erica Jul 24 '14 at 11:05
  • it works with just one: ASCII inASCII = r"D:\Julia_T\2000067_cloud_free.asc" outRaster = r"D:\Julia_T\output" rasterType = "INTEGER" arcpy.ASCIIToRaster_conversion(inASCII,outRaster,rasterType) – Nora Jul 24 '14 at 12:40
  • Good, so the raster files are not the problem. Try using the full path as Hornbydd proposes in his answer. – Erica Jul 24 '14 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.