<NME> geocode.py
<BEF> from django.utils.encoding import smart_str

from geopy import geocoders
from geopy import geocoders
from geopy.exc import GeocoderServiceError

class Error(Exception):
    pass



def google_v3(address):
    """
    Given an address, return ``(computed_address, (latitude, longitude))``
    tuple using Google Geocoding API v3.
    try:
        g = geocoders.GoogleV3()
        address = smart_str(address)
        return g.geocode(address, exactly_one=False)[0]
    except (UnboundLocalError, ValueError, GeocoderServiceError) as e:
        raise Error(e)
        raise Error("No results found for '%s'" % address)
    except (UnboundLocalError, ValueError, GeocoderServiceError) as e:
        raise Error(e)

<MSG> Resolve the 500 error when google send a no results info

<DFF> @@ -4,6 +4,7 @@ from django.utils.encoding import smart_str
 from geopy import geocoders
 from geopy.exc import GeocoderServiceError
 
+
 class Error(Exception):
     pass
 
@@ -16,6 +17,9 @@ def google_v3(address):
     try:
         g = geocoders.GoogleV3()
         address = smart_str(address)
-        return g.geocode(address, exactly_one=False)[0]
+        results = g.geocode(address, exactly_one=False)
+        if results is not None:
+            return results[0]
+        raise Error('No results found')
     except (UnboundLocalError, ValueError, GeocoderServiceError) as e:
         raise Error(e)

Resolve the 500 error when google send a no results info