It's been only few days that i've been working in python environment.
Based on this code, i've been trying to batch few process for our QAQC task's. At certain times, like when i use Describe.(path_in_a_csv) i am always getting this error "Input value is not valid type". Even here, only with the help of Philip i was able to make the code run successfully. I tried the same thing arcpy.ExportMosaicDatasetPaths_management(path_in_a_csv,"Output"). The error was "not able to execute the tool".
Though i've been trying to understand this for the past couple of days, i couldn't able to crack it. It'll be of great help if anyone shed a bit of light on how to go from here.
import csv
import arcpy
from os import path
csvpath = r"D:\QAQC\Chk_Rep_File_list.csv"
with open(csvpath, "r") as csvfile:
fcs = [r[0] for r in csv.reader(csvfile)]
for fc in fcs:
desc = arcpy.Describe(fcs)
RuntimeError: Object: Describe input value is not valid type
1 Answer 1
This line desc = arcpy.Describe(fcs)
should be desc = arcpy.Describe(fc)
- you have fcs
which is a list of all files from your CSV, and instead it should be fc
for each file one at a time (since you're looping through fcs one at a time in the for fc in fcs:
loop).
import csv
import arcpy
from os import path
csvpath = r"D:\QAQC\Chk_Rep_File_list.csv"
with open(csvpath, "r") as csvfile:
fcs = [r[0] for r in csv.reader(csvfile)]
for fc in fcs:
desc = arcpy.Describe(fc)
print "Name = {}".format(desc.name)
print "\tData Type = {}".format(desc.dataType)
print "\tPath = {}".format(desc.path)
As you had it, you would get no feedback if the script ran successfully. I have added the three print
statements at the end to output some results from your Describe
.
-
Thanks a lot for the explanation. Worked perfectly. But if i apply the same thing to this code, it didn't work. This is the thing thats been bugging me for days. Why it's not working for this code ? arcpy.ExportMosaicDatasetPaths_management(fcs) - part gis.stackexchange.com/questions/191202/…joseph_k– joseph_k2016年04月30日 05:40:13 +00:00Commented Apr 30, 2016 at 5:40
-
at a guess you'd need to use
fc
notfcs
, but also include an output table as per Export Mosaic Dataset Paths2016年04月30日 05:50:19 +00:00Commented Apr 30, 2016 at 5:50 -
but best put in a new question I think2016年04月30日 05:50:34 +00:00Commented Apr 30, 2016 at 5:50
-
For the sake of explaining it to you, i've omitted that "Output_table" part. Anyway will try to figure it outjoseph_k– joseph_k2016年04月30日 07:45:09 +00:00Commented Apr 30, 2016 at 7:45
desc = arcpy.Describe(fcs)
should bedesc = arcpy.Describe(fc)