Jay42 Jay42 - 4 months ago 17
Python Question

AttributeError: 'module' object has no attribute 'inet_pton'

When I run this, or any webpy program I get the below error. I have tried different names, like

, and
. I have turned off ipv6 on my windows 7 computer, and nothing seams to fix this issue. how can I fix this error?

import web

urls = ( '/','Index',

class Index:
def GET(self):
return "Hello,world!"


if __name__=="__main__":

Traceback (most recent call last):
File "C:\Users\Jay\workspace\test3\test2.py", line 13, in <module>
File "C:\Python27\lib\site-packages\web\application.py", line 313, in run
return wsgi.runwsgi(self.wsgifunc(*middleware))
File "C:\Python27\lib\site-packages\web\wsgi.py", line 55, in runwsgi
server_addr = validip(listget(sys.argv, 1, ''))
File "C:\Python27\lib\site-packages\web\net.py", line 108, in validip
if validip6addr(ip): return (ip,port)
File "C:\Python27\lib\site-packages\web\net.py", line 33, in validip6addr
socket.inet_pton(socket.AF_INET6, address)
AttributeError: 'module' object has no attribute 'inet_pton'


I needed to change line 33 in net.py from: except socket.error: to except (socket.error, AttributeError).

More information here.