Error while running python script to get pixel points from google static map image - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Error while running python script to get pixel points from google static map image (/thread-5006.html) |
Error while running python script to get pixel points from google static map image - python_newbee - Sep-14-2017 Error while running python script to get pixel points from google static map image. I got the python script from https://stackoverflow.com/questions/5401661/google-maps-how-to-get-buildings-polygon-coordinates-from-address. I use python2.7 to execute the script Initially when i was running the script i was not getting any error, but after continuous running for 3-4 hours i am getting the following error Traceback (most recent call last): File "pyscript.py", line 19, in <module> imgBuildings = io.imread(urlBuildings) File "/usr/local/lib/python2.7/dist-packages/skimage/io/_io.py", line 60, in i with file_or_url_context(fname) as fname: File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__ return self.gen.next() File "/usr/local/lib/python2.7/dist-packages/skimage/io/util.py", line 29, in u = urlopen(resource_name) File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python2.7/urllib2.py", line 435, in open response = meth(req, response) File "/usr/lib/python2.7/urllib2.py", line 548, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python2.7/urllib2.py", line 473, in error return self._call_chain(*args) File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 403: Forbidden AS i am new to python i am not sure how to fix it ? Is this some kind of cache issue? Help very much appreciated. RE: Error while running python script to get pixel points from google static map image - nilamo - Sep-14-2017 (Sep-14-2017, 01:09 PM)python_newbee Wrote: urllib2.HTTPError: HTTP Error 403: Forbidden That's not a cache issue. That's the server telling you that you don't have permission to view whatever resource you're requesting. There might be more text that comes along with that (...there probably isn't). You should check the docs for whatever you're doing to see if they have rate limits (how often you can request something), since you said it was running for a few hours. RE: Error while running python script to get pixel points from google static map image - metulburr - Sep-14-2017 Quote:Initially when i was running the script i was not getting any error, but after continuous running for 3-4 hours i am getting the following errorYou probably triggered yourself as a bot. RE: Error while running python script to get pixel points from google static map image - python_newbee - Sep-15-2017 Hi guys, Thanks for the reply. @nilamo. i am running this continuously. Whenever we need to get some coordinates we call the script with minimum 2 - 50 points(latlng) in each request. The python script process each points with the help of the libraries. import sys import numpy as np from requests.utils import quote from skimage.measure import find_contours, points_in_poly, approximate_polygon from skimage import io from skimage import color from threading import Thread Normally it takes up to 10 seconds to 40 seconds for each points. And it runs continuously. @metulburr may be it works as a bot. One interesting finding is:- Initially i installed this on one server(server1) and after testing for couple of days i got the error. As i am new t python was not not able get any answers for this i moved on to another server(server2). I installed all the libraries in server2. Then again started testing in this of couple of weeks. Suddenly yesterday server2 also started showing the same error. Just for check i went back to server1 and run the script then i saw there its working normal without any error. But after a couple of hours server1 again started showing errror. Strange that server1 automatically started working after a couple of weeks. Due to this i felt it might be any memory allocation or cache issue. Also some deadlock due to continuous running. Any more help guys ? I am completely struck due to this. |