pygeoip.GeoIPError: Invalid database type, expected Org, ISP or ASNum
timss opened this issue · 3 comments
I'm getting an error when trying to use pygeoip's org_by_name(self, hostname)
, but other functions work fine (as far as I've tested).
Tried on both Ubuntu 12.10 and Debian 6 Squeeze, with both geoip-database
from their respective repositories and manual download from GeoIP Country Database Installation Instructions.
Python version is 2.7.3 in both cases
pygeoip is newest from PyPi, 0.2.6
>>> import pygeoip
>>> gi = pygeoip.GeoIP("/usr/share/GeoIP/GeoIP.dat", pygeoip.MEMORY_CACHE)
>>> gi.country_code_by_name("thevoid.no")
'DE'
>>> gi.org_by_name("thevoid.no")
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pygeoip/__init__.py", line 548, in org_by_name
return self.org_by_addr(addr)
File "/usr/local/lib/python2.7/dist-packages/pygeoip/__init__.py", line 531, in org_by_addr
raise GeoIPError(message)
GeoIPError: Invalid database type, expected Org, ISP or ASNum
I don't know if there's a problem with pygeoip or the database.
Relevant entry on Stackoverflow.com: What is the equivalent of PHP's geoip_isp_by_name function?
There are different kinds of GeoIP databases, the country database does not contain Org data. You can read more about the Org database here: http://www.maxmind.com/en/organization
@tiwilliam Ah, ok thanks!