Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'str' does not support the buffer interface (py3 compat issue?) #2

Open
bsdlp opened this issue Mar 2, 2014 · 13 comments
Open

Comments

@bsdlp
Copy link

bsdlp commented Mar 2, 2014

(env)jchen@hobbes-(master|✔)> pip3.3 freeze -l
Flask==0.10.1
Flask-Script==0.6.7
Jinja2==2.7.2
MarkupSafe==0.18
Werkzeug==0.9.4
itsdangerous==0.23
python-geoip==1.2
python-geoip-geolite2==2014.0207
(env)jchen@hobbes-(master|✔)> python3
Python 3.3.4 (default, Feb 15 2014, 11:45:50)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from geoip import geolite2
>>> match = geolite2.lookup('66.228.43.47')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jchen/git/mirror_selector/env/lib/python3.3/site-packages/geoip.py", line 364, in lookup
    return self._get_actual_db().lookup(ip_addr)
  File "/Users/jchen/git/mirror_selector/env/lib/python3.3/site-packages/geoip.py", line 350, in _get_actual_db
    rv = self._load_database()
  File "/Users/jchen/git/mirror_selector/env/lib/python3.3/site-packages/geoip.py", line 342, in _load_database
    return mod.loader(self, sys.modules[__name__])
  File "/Users/jchen/git/mirror_selector/env/lib/python3.3/site-packages/_geoip_geolite2/__init__.py", line 9, in loader
    return mod.open_database(filename)
  File "/Users/jchen/git/mirror_selector/env/lib/python3.3/site-packages/geoip.py", line 508, in open_database
    md = _read_mmdb_metadata(buf)
  File "/Users/jchen/git/mirror_selector/env/lib/python3.3/site-packages/geoip.py", line 382, in _read_mmdb_metadata
    buf.size() - MMDB_METADATA_BLOCK_MAX_SIZE)
TypeError: 'str' does not support the buffer interface
@emilgpa
Copy link

emilgpa commented Mar 6, 2014

Here same problem.

@nephics
Copy link

nephics commented Apr 5, 2014

+1 for Python 3 support

@annndrey
Copy link

annndrey commented Feb 4, 2015

Same problem here.

@busla
Copy link

busla commented May 8, 2015

Yeah, same here.

@bogdal
Copy link

bogdal commented May 8, 2015

maxminddb-geolite2 is a good alternative and it supports python3.

@busla
Copy link

busla commented May 8, 2015

Thanks mate, works perfectly.

@crclayton
Copy link

Same problem. Neither src_ip.encode("utf-8") or bytes(src_ip, "utf-8") help.

@yanagiragi
Copy link

Platform : Window7 64 bit
Same Problem. bytearray(src_ip, "utf-8") doesn;t help

However it works fine on Ubuntu

@email365
Copy link

still experiencing the same error, any update or solution?

@fl0wjacky
Copy link

+1 for Python 3 support

@datng2
Copy link

datng2 commented Oct 21, 2019

For those who came across this issue, please consider using GeoIP2 https://github.com/maxmind/GeoIP2-python

@arshbot
Copy link

arshbot commented Feb 5, 2020

@datng2 is it a direct stand in replacement?

@datng2
Copy link

datng2 commented Feb 5, 2020

@arshbot I would recommend taking a look MaxMind DB reader as well. I think it also supports Enterprise version if you need to upgrade later.

https://github.com/maxmind/MaxMind-DB-Reader-python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests