[Tutor] Problem in running script

Hugo Arts hugo.yoshi at gmail.com
Tue Nov 1 23:33:53 CET 2011


On Tue, Nov 1, 2011 at 10:47 PM, Narguess Dadfar
<dadfar.narguess at gmail.com> wrote:
> I want to prepare a script in python that updates the attributes of the
> crime incidents falling within the patrol zone. I have  a point feature
> class of crime incidents and a polygon feature class of patrol zone.
>
> I used the getcount. method to take a count of the incidents in the current
> layer as the script goes the each loop, returns an integer value, and adds
> 1. The update cursor then updates the “INCIDENT” field. The calculations to
> be performed in order to determine the incidents per square mile are: taking
> the Shape_area in meters and converting it to miles by dividing it by the
> constant provided and then dividing the number of incident by the converted
> shape area(in miles). The incidents per square mile will then be used to
> rank the priority of graffiti incidents in each zone. This was done with an”
> if/elif/else” statement where the first “if” is the “Top Priority” and the
> rest of the ranks follow as they meet the conditions in the consecutive
> statement. An update cursor is written into each of the “if/elif/else” parts
> of the statement to update the “PRIORITY “ field while the script is running
> through the current zone each time it loops.But I ran to problem. Please let
> me know what I should change.
>

I'm sorry, but did you say you "ran to problem?" I don't mean to
offend, but that's by far the worst problem description I've ever
encountered. Please, include relevant code, errors given by the python
interpreter, expected results, and make sure to let us know if you're
doing a homework assignment.

Also, consider reading "How to ask questions the smart way." It's a
long read but you'll help yourself and everyone on the internet for
the rest of your life by reading it:
http://catb.org/~esr/faqs/smart-questions.html

We can't magically access your computer and see your code. I have no
idea what you should change if all I'm given is a paragraph of
ambiguous, incomplete English description of your code and the words
"I ran to problem."

Hugo


More information about the Tutor mailing list