OpenCageData / python-opencage-geocoder

Python module to access the OpenCage geocoding API
https://opencagedata.com/tutorials/geocode-in-python
Other
78 stars 22 forks source link

"ImportError: No module named opencage.geocoder" #8

Closed shihas1991 closed 9 years ago

shihas1991 commented 9 years ago

I just go through the sign up process and generate api key. For importing the api from python https://github.com/opencagedata/python-opencage-geocoder .I am getting an error "ImportError: No module named opencage.geocoder"

sabarasaba commented 9 years ago

I'm no python expert, but I managed to make it work by just cloning the repo:

git clone https://github.com/jkbr/httpie.git

Then just run the setup.py file from that directory:

sudo python setup.py install

Once we fix #5 it will only be a matter of doing pip install opencage-geocoder

mtmail commented 9 years ago

You're right. The module is now on https://pypi.python.org/pypi/opencage/1.1.0 and installable with pip.

sabarasaba commented 9 years ago

Awesome, thanks @mtmail ! :tada:

shihas1991 commented 9 years ago

Thanks for the quick reply. Successfully installed the opencage with pip install opencage.But I stuck with an error from opencage.geocoder import OpenCageGeocode

key = 'my_key' geocoder = OpenCageGeocode(key) results = geocoder.reverse_geocode(51.51024, -0.10303) Traceback (most recent call last): File "", line 1, in File "opencage/geocoder.py", line 147, in reverse_geocode return self.geocode(_query_for_reverse_geocoding(lat, lng)) File "opencage/geocoder.py", line 100, in geocode if six.PY2: AttributeError: 'module' object has no attribute 'PY2'

mtmail commented 9 years ago

Thanks the new bug report.

This is fixed in version 1.1.1. You can install it by running

pip install -upgrade opencage

Explanation:

Basically your installed version of the package six is more than a year old. We require at least version 1.4. The opencage package now sets the dependency correct.

You can find the current version of the page six by running

python --version
python -c 'import six; print six.__file__; print six.__version__'
shihas1991 commented 9 years ago

Wowww...Thanks ...issue solved