l3ll0

Different results between python window and stan-alone script

Discussion created by l3ll0 on Jan 24, 2011
Latest reply on Jan 26, 2011 by l3ll0
hi all,
that's the problem:
i've a script that works fine inside the python window in arcgis (10) and it doesn't from the command line. the results are completely different: results in arcgis python window are correct!
here is my code


.....other code here

where_z = "\"[IDCD] = " + str(CDD) + "\""
print where_z
my_z = arcpy.MakeTableView_management(r"E:\DB1.mdb\ZONA", "zone")
rows = arcpy.SearchCursor(r"E:\DB1.mdb\ZONA", where_z)
fields = arcpy.ListFields(my_z,"ID","All")
for row in rows:
 for field in fields:
  if field.name == "ID":
   nIDZ = row.getValue(field.name)
   print nIDZ

.....other code here



if i run the scripts from the command line the print statement returns ALL the value in the table. it seems that rows = arcpy.SearchCursor(r"E:\DB1.mdb\ZONA", where_z) does not honor the {where_clause} specified by the variable where_z.

any advice??

thanks in advance,
ciao

Outcomes