Select to view content in your preferred language

Geoprocessing Service Only Runs Once

06-01-2014 09:15 AM
New Contributor

I am trying to publish an ArcGIS geoprocessing service in 10.2 I have a script setup that will run multiple times through Pycharm, but when I run it in ArcGIS it will run once and return this error:

Traceback (most recent call last):
  File "C:\Users\\Desktop\git\", line 477, in <module>
  File "C:\Users\Desktop\git\", line 372, in main
  File "C:\Users\Desktop/git\", line 136, in value_query
    results = cur.fetchall()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\psycopg2\", line 81, in fetchall
    res = super(DictCursorBase, self).fetchall()
  File "C:\Python27\ArcGIS10.2\Lib\", line 543, in __new__
    m = _parser(value.strip())
TypeError: 'NoneType' object is not callable

Failed to execute (Script).

The script itself is 800 lines, but here is the query I have been running that errors out:
def value_query(id_field, id, value_fields, start_date, end_date, date_field, table, cur):
    query2 = "SELECT "
    for field in value_fields:
        query2 += "NULLIF({0}, '-999')::NUMERIC(6,2),".format(field)
    query2 += "{0} " \
            "FROM {1} " \
            "WHERE {2} = '{3}' AND {0} BETWEEN '{4}' AND '{5}' " \
            "ORDER BY {0} ASC;".format(date_field, table, id_field, id, start_date, end_date)
    #print "This is Query:"
    #print query

    results = cur.fetchall()

    #print "These are value query results:\n\n {0}".format(results)
    return results

Like I said it runs once in ArcGIS then errors out. However, if I close Arc completely and run the exact same script again, it runs once then stops. I feel like there may be some sort of caching or something that Arc does, but am completely stumped.
0 Kudos
1 Reply
Frequent Contributor
This sounds something similar to what happened in my thread here.  If anything you have is running out of GDB, make sure you are usually a fully qualified pathname line (os.path.join etc etc).

I have no idea if that is possibly related or not.
0 Kudos