likekeustc
likekeustc

Reputation: 71

cannot import name GoogleMaps

I followed the instruction

pip install GoogleMaps

to install google maps. but when I tried to import the GoogleMaps class, it failed although googlemaps is installed.

Python 2.7.6 (default, Mar 22 2014, 22:59:38)  [GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import googlemaps 
>>>
>>> from googlemaps import GoogleMaps 
Traceback (most recent call last):   
File "<stdin>", line 1, in <module> 
ImportError: cannot import name GoogleMaps

Does anyone know why GoogleMaps cannot be imported although googlemaps is installed?

Upvotes: 7

Views: 12409

Answers (2)

Michele d&#39;Amico
Michele d&#39;Amico

Reputation: 23741

Maybe the documentation is a little bit outdated: use Client instead of GoogleMaps

>>> from googlemaps import Client
>>> dir(Client)
['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_generate_auth_url', '_get', 'directions', 'distance_matrix', 'elevation', 'elevation_along_path', 'geocode', 'reverse_geocode', 'timezone']
>>> help(Client)

Upvotes: 8

Sagar
Sagar

Reputation: 2385

I think there is no class defined named GoogleMaps in googlemaps module.

if you try help(googlemaps) in python interpreter then you can able to see all the classes.

I hope this helps you.

Upvotes: 3

Related Questions