mitsuhiko / mitsuhiko/python-geoip
TypeError: 'str' does not support the buffer interface (py3 compat issue?)
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 246
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
(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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Python 3.3 failure with geolite2.lookup and start in geoip.py, following _geoip_geolite2/init.py through _load_database and _read_mmdb_metadata. Determine why the database metadata read rejects the loaded value; done means the reported lookup completes successfully under Python 3 without regressing database loading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100