Closed masapasa closed 3 years ago
Looks like the street view api is returning an empty response. I’ll push some checks and error handling to make this more graceful this evening. Do your environment variables look right? What url did you put? The site is working for me so I need a few more details to reproduce.
On Jan 25, 2021, at 2:30 PM, Aswin Pyakurel notifications@github.com wrote: $ flask run
Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. Debug mode: off Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) 127.0.0.1 - - [25/Jan/2021 19:37:24] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [25/Jan/2021 19:37:25] "GET /favicon.ico HTTP/1.1" 404 - requesting from https://maps.googleapis.com/maps/api/streetview?location=new+york&size=640x640&key=AIzaSyBIiA6UsMwEhbzTs14V5CRzp2bR0UlsC8w&signature=pUOOtvg9QM_TCYtXtUoXMgeC2pc= 403 [2021-01-25 19:37:34,720] ERROR in app: Exception on / [POST] Traceback (most recent call last): File "/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/python3.8/site-packages/flask/_compat.py", line 39, in reraise raise value File "/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functionsrule.endpoint File "/home/aswin/Documents/bernie-sits/app.py", line 18, in login image = add_bernie(img_bytes) File "/home/aswin/Documents/bernie-sits/images.py", line 75, in add_bernie alpha_l * l_img[y1:y2, x1:x2, c]) TypeError: 'NoneType' object is not subscriptable 127.0.0.1 - - [25/Jan/2021 19:37:34] "POST / HTTP/1.1" 500 - — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
export API_URL='https://maps.googleapis.com/maps/api/streetview' export KEY='' export SECRET='' I used this for env var
You have the secret and key right?
I was able to replicate this error with an expired API key. Try regenerating your key and setting the appropriate environment variables.
If that doesn't work, use a browser to navigate to the url in the flask app output above the status code (which I assume in your case will be 403
) and feel free to put what you see in this thread.
In general, the error means that you attempted to index an object that doesn't have that functionality. You are trying to subscript an object which you think is a list or dict, but actually is None. This means that you tried to do:
None[something]
NoneType is the type of the None object which represents a lack of value, for example, list1 = list.sort(list1) : - here, you are setting it to None. None always has no data, so NoneType object is not subscriptable. In order to correct this error this should be list1.sort().
You're getting None because you're not getting image data back from the Google Street View API. The overlaying function subscripts the image data, hence why you're specifically getting a subscription error. As I said above, this is likely because you're using an expired google API key. Have you tried regenerating the key yet? There have also been a few other bugs that I've fixed over the last few months so make sure you're using the latest version!
$ flask run