appliedsec/pygeoip

Instantiating GeoIp second time takes forever

prakashpp opened this issue · 3 comments

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,

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

Here is the commit 4d6725c

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