I am trying to put together a tool for calculating the angles of lines but I keep getting this error: "Parameters are not valid. ERROR000735". I am new learning arcpy, can anyone tell me what have I done wrong here?
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">import</SPAN> math
in_table <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>GetParameterAsText<SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN>
field <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>GetParameterAsText<SPAN class="punctuation token">(</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AddField_management<SPAN class="punctuation token">(</SPAN>in_table<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"angle"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"DOUBLE"</SPAN><SPAN class="punctuation token">)</SPAN>
expression <SPAN class="operator token">=</SPAN> <SPAN class="string token">"GetAzimuthPolyline(!shape!)"</SPAN>
codeblock <SPAN class="operator token">=</SPAN> <SPAN class="string token">"""def GetAzimuthPolyline(shape):
radian = math.atan((shape.lastpoint.y - shape.firstpoint.y)
/(shape.lastpoint.x - shape.firstpoint.x))
degrees = radian * 180/math.pi
return degrees"""</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CalculateField_management<SPAN class="punctuation token">(</SPAN>in_table<SPAN class="punctuation token">,</SPAN><SPAN class="string token">'angle'</SPAN><SPAN class="punctuation token">,</SPAN>expression<SPAN class="punctuation token">,</SPAN><SPAN class="string token">'PYTHON'</SPAN><SPAN class="punctuation token">,</SPAN>codeblock<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
