Skip to content
This repository was archived by the owner on Apr 10, 2018. It is now read-only.

python 2.7 support on Windows #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pygeoip/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def ip2long(ip):
try:
return int(binascii.hexlify(socket.inet_aton(ip)), 16)
except socket.error:
return int(binascii.hexlify(socket.inet_pton(socket.AF_INET6, ip)), 16)
try:
return int(binascii.hexlify(socket.inet_pton(socket.AF_INET6, ip)), 16)
except AttributeError:
import win_inet_pton
return int(binascii.hexlify(socket.inet_pton(socket.AF_INET6, ip)), 16)


def str2fp(data):
Expand Down