Google Vision unable to find server

I am using the latest NOOBS but I was following your video carefully. Everything seems ok but I get an error that httplib2.ServerNotFoundError: Unable to find server at www.googleapis.com – any ideas what could cause this error. I am running out of python 2.7.13

Thanks,
Donald

Hi @donaldw12,

  1. Are you running the latest Jessie/Stretch release of Raspbian or are you running Raspbian For Robots?

  2. Can you give us more details on what are you trying to do?
    What tutorial are you following?
    At what step you’ve got into this issue?
    Share some useful screenshots?
    Share a complete traceback of the error you’ve encountered.

  3. Do you have internet connection on your Pi?

Waiting for some input from you.

Thank you!

Thanks for getting back to me.
pi_error

I am following this tutorial https://www.youtube.com/watch?v=p7zpfXG15ho&t=746s And I was able to follow along until he actually ran the camera.vision.logo.py program. I am not running Raspbian for Robots, I am running lastest NOOBS from the Raspberry Pi website (9.1 stretch). The pi is definitely connected to the internet as I had to install a number of packages as per the tutorial. I am trying to get the pi to take a picture and have the Google Vision API recognize the object. A screen shot of the error is included here. Thanks again!

Hi @donaldw12,

Judging by how it looks, I’d say there’s something wrong with the DNS settings.
I’ve looked on the web and searched for this error and the common denominator I got is the DNS - specifically, the nameserver that’s set.

Here are 2 issues I found interesting (use google translate on the 1st link):

It also may be because Google is continually changing its API, which in turn it makes hard for all of us to follow what they change.d

Let me also bring @JohnC into this discussion as he may know more about this subject.

By the way, is this error keep being shown on every run or does the script work from time to time?

Thank you!

Thanks! I think I found those links as well. Although my spanish is not great. The script has never worked. I did try changing this.

I added DISCOVERY_URL = “https://{api}.googleapis.com/$discovery/rest?version={apiVersion}”

And then I modified the build command to:

service = discovery.build(‘vision’, ‘v1’, credentials = credentials, discoveryServiceUrl = DISCOVERY_URL)

This is the command that is throwing the error. This changed the error from ServerNotFound www. googleapis. com to ServerNotFound vision. googleapis. com. I can ping www. googleapis. com and vision. googleapis. com no problem.

I am not very familiar with DNS errors our how to troubleshot them. Thanks again for your help. I had to add spaces in the web addresses above due to some limit on the number links in the post.

@donaldw12 what happens when you run:

ping www.googleapis.com

Do you get a response from the server?

JohnC - yes I was able to ping both www.googleapis. com and vision.googleapis. com – However, I was able to fix the problem. I downloaded the Google Cloud Client to my Windows computer and during the set up it said that the API [compute.googleapis.com] was not enabled and asked if I wanted to enable it - so I did. It then asked if I wanted to configure the Google Compute Engine so I said yes. Once it had done these two things the code you guys provided worked on the Pi.

Ok, the behavior is really weird. If I take the picture in the program using the takephoto() function I get a different ServerNotFoundError - it errors out on this statement response = service_request.execute() . If I don’t take the picture in the program but just load the image from disk it works fine. This is reproducible.

Refresh my memory . . . are you working with this repo?

Yes that is the one.

Not sure what’s going on here. Which of the three programs are you using?

One possible problem: if you’re not running it from the directory the program is in, it might not be finding the picture for upload.

What is the specific error you’re seeing?

I am running camera-vision-label.py The program works when I don’t take the picture (comment out the call to function to take the picture) so it is pulling the picture fine. The error I am getting is above in this thread. My second post.

@donaldw12 when you run the program, with takephoto() included, do you see a file (image.jpg) in the directory you’re working out of? It looks like you’re working out of the home directory ~ ; so if you delete any files named image.py in the home directory (confirming with an ls ) and then run the program again, do you have an image file named image.py in it?

Yes there is a file called image.jpg in the home directory I am using /home/pi - I deleted the picture and ran the program again. I got the error posted up above, but the image.jpg file was saved. I then commented out the takephoto() function ran the program again and it worked. Something about operating the camera causes an error when it executes this line - service = discovery.build(‘vision’, ‘v1’, credentials = credentials, discoveryServiceUrl = DISCOVERY_URL).

Donald

So I put in a 30 second pause after the takephoto() function call and now it works fine… Not sure what is going on. I will try and see how short I can make the pause.

Thanks for your help,
Donald

Great! Glad to hear it works! There may have been something changed about the camera; also if you added threading that might also have affected it. Good to hear!