Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

ArcGIS arcpy code fails in Toolbox mode

$
0
0

This code executes correctly in Python window but fails with

ERROR 000732: Input Table: Dataset JHJ does not exist or is not supported

# Import ArcPy and other required modules
import arcpy
from arcpy import env
import fileinput
import string
import os
env.overwriteOutput = True
filud=file(r"c:tempdum.txt","w")     # Open file for debug output
filud.write("Hello n")
try:
   # Will create shape file fcname.shp
   arcpy.CreateFeatureclass_management(r"C:tempTestArcGisFraFil","JHJ","Polyline")
   filud.write(str(time.time()) + " After create n")
except Exception as e:
   filud.write(str(time.time()) + "Error: " + e.message + "n")
try:
   # Add fields for data
   filud.write(str(time.time()) + " Before Addfield " + "JHJ" + "n")
   arcpy.AddField_management("JHJ","Sbet","TEXT")
except Exception as e:
  print e.message
  filud.write("Error: " + e.message)
filud.close()

Viewing all articles
Browse latest Browse all 767

Trending Articles