appliedsec / pygeoip

DEPRECATED: Pure Python API for Maxmind's binary GeoIP databases
https://github.com/appliedsec/pygeoip
GNU Lesser General Public License v3.0
481 stars 111 forks source link

Instantiating GeoIp second time takes forever #57

Closed prakashpp closed 10 years ago

prakashpp commented 10 years ago

Hi,

I am not sure it is a right behavior, but when I instantiate GeoIP second time(first time incorrect file location) it take forever.

Here is the traceback-

>>> from pygeoip import GeoIP
>>> geoip = GeoIP('/usr/share/GeoIP/GeoIP.dat')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/pygeoip/__init__.py", line 77, in __call__

  File "build/bdist.linux-x86_64/egg/pygeoip/__init__.py", line 121, in __init__

  File "/home/prakash/.virtualenvs/nereid-crm/lib/python2.7/codecs.py", line 881, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 2] No such file or directory: '/usr/share/GeoIP/GeoIP.dat'
>>> geoip = GeoIP('/usr/local/Cellar/geoip/1.4.8/share/GeoIP/GeoIP.dat)

It hangs after this,

tiwilliam commented 10 years ago

This is fixed in master, it was an issue with thread locks on an initial exception.

tiwilliam commented 10 years ago

Here is the commit 4d6725c40911520d58cf5b59bb15bdb51c283f6d

prakashpp commented 10 years ago

Ah! I was installing it from pypi, version 0.3.0. Thanks :)