Thursday, May 24, 2012

Re: Django GeoIP Module not found; can't remedy

It appeared an import statement error caused the initial problem. But once that was fixed, the following error results:

">>> from django.contrib.gis.utils.geoip import GeoIP
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/gis/utils/geoip.py", line 68, in <module>
    lgeoip = CDLL(lib_path)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/usr/local/lib/libGeoIP.dylib, 6): no suitable image found.  Did find:
        /usr/local/lib/libGeoIP.dylib: mach-o, but wrong architecture"

Anyone have a clue on how to remedy this?

On Thursday, May 24, 2012 7:10:50 PM UTC-4, DF wrote:

I've spent several hours attempting to resolve my problems setting up GeoIP in Django to no avail and was hoping to get some guidance on what the problem(s) might be.

I'm working on an existing Django application that required some geolocation abilities, specifically getting a users IP and lat/long and then placing that info on a map marker. GeoIP and the associated libraries appeared to be the best solution for the first step.

I installed GeoIP on a Mac using Homebrew. I then manually created a folder in the root directory of my project with the GeoIPv6.data and GeoLiteCity.dat files. After this, I added the path in my settings file:

import os

DEBUG = True

TEMPLATE_DEBUG = DEBUG

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

GEOIP_PATH = os.path.join(BASE_DIR, 'geoip'),

I then opened a command shell for the project and received the following error:

>>> from django.contrib.gis.geoip import GeoIP

Traceback (most recent call last):

  File "<console>", line 1, in <module>

ImportError: No module named geoip

I can't seem to remedy this problem. One issue that may be the cause is extracting the two dat.gz files was an issue. Neither could be unzipped from the command line – neither are .zip files – and had to use Stuffit Expander to open these. The resulting dat files in my project IDE (pyCharm) have a VLC (?) icon on each. Perhaps this is part of the issue (finding a way to uncompress the file was a challenge in itself). I'm not sure as the module was not even found.

Any help would be extremely appreciated in resolving this issue as I can't progress any further without figuring out what's wrong.

Many thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/HYN3pfOXCNIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate