purid

Python URLEn character limit and update cursor

Discussion created by purid on Jun 29, 2012
I am trying to query elevations for 87 points in a python script. I can obtain the results if I leave last two points. It gives me error, if I include all the points, I get this error:

response = simplejson.load(urllib.urlopen(url))
  File "C:\Python27\ArcGIS10.1\lib\json\__init__.py", line 278, in load
    **kw)
  File "C:\Python27\ArcGIS10.1\lib\json\__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\ArcGIS10.1\lib\json\decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\ArcGIS10.1\lib\json\decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
if I copy all the points in a URL and run manually. It works fine without error. I can't understand this error message. Other than a character limit of URL here, I can't think of anything... Any idea?? And if there is a limit - what is it- because there can be 1000 or more points...

So if it is character limit, I have to run URL in batches- 1-50, 51-100... till end value (get counts), but at the end I am generating an array of elevation which I want to use to run UpdateCursor. Can I run cursor in batches??

Thanks

Outcomes