error 000861: Destination field is not valid:

1754
3
04-10-2014 06:26 AM
JuanSerratosa_López
New Contributor
Hi everyone,

First I would like to highlight that  I´m an absolut newby with python.
I trying to use this already created python tool but keep on receiving this error message: error 000861: Destination field is not valid:

It's a nested code so would be difficult to put all the different variables but the specific part of the code that is giving this problem is this:

gp.CostPath_sa("samp_lyr", cd_name, bl_name, "cost_path", "BEST_SINGLE", "")


All the input variables are fine, the only error cames from the last one (destination field) wich it´s supposed to be an optional variable. That´s why the "", because is empty. 

Any suggestions??

Hope can understand the post.
Thanks!!
Tags (2)
0 Kudos
3 Replies
JamesCrandall
MVP Frequent Contributor
Maybe this?


gp.CostPath_sa("samp_lyr", cd_name, bl_name, "cost_path", "BEST_SINGLE", "#")

0 Kudos
IanMurray
Frequent Contributor
alternatively you could just leave the optional field off.


gp.CostPath_sa("samp_lyr", cd_name, bl_name, "cost_path", "BEST_SINGLE")



if not ArcGIS help says

destination_field
(Optional)

"The field used to obtain values for the destination locations.
Input feature data must contain at least one valid field."

Make sure your input variables have a valid field.
0 Kudos
JuanSerratosa_López
New Contributor
Thanks Ian and James for your answers,

Finally the problem was that if you use a feature class as an input destination (not a raster) the input field is not optional. So I had to create the field and write the name in the code.

Cheers!!
0 Kudos