Python Forum
Error while running python script to get pixel points from google static map image
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error while running python script to get pixel points from google static map image
#1
Error while running python script to get pixel points from google static map image. I got the python script from https://stackoverflow.com/questions/5401...om-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.
Reply
#2
(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.
Reply
#3
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 error
You probably triggered yourself as a bot.
Recommended Tutorials:
Reply
#4
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. Cry
Any more help guys ?
I am completely struck due to this.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error in running the Elliott Fitting function shashisourabh 9 5,150 Nov-19-2020, 06:54 PM
Last Post: osvan
  Error sending and receiving a base 64 encoded image to an API lagarcia 0 1,907 Jun-24-2020, 05:55 AM
Last Post: lagarcia
  convert images into pixel dataframe into csv file using python synthex 3 17,416 Feb-17-2019, 06:26 AM
Last Post: scidam
  panda, excel - script pauses and doesn't continue running, no error message william 1 2,653 Nov-24-2018, 01:24 AM
Last Post: ichabod801
  Newbie at using python and tensorflow getting error when running simple code FeatherineAu 0 3,962 Sep-28-2018, 02:09 PM
Last Post: FeatherineAu
  Error for convert image PIL to CV2 karlo123 2 4,754 May-07-2018, 03:14 AM
Last Post: karlo123
  Button Press When Pixel Color Changes bak989 0 3,680 Apr-22-2018, 04:03 PM
Last Post: bak989
  Change color pixel in an image louloudevinci 2 38,907 Mar-25-2018, 08:27 PM
Last Post: louloudevinci
  Python pandas dataframe simulate football points system. zydjohn 0 2,183 Mar-11-2018, 11:42 PM
Last Post: zydjohn

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020