当我运行这个,或任何webpy程序时,我得到以下错误。我尝试了不同的名字,如test.py
和server.py
。我在我的Windows 7电脑上关掉了ipv6,没有任何接缝可以解决这个问题。我该如何解决这个错误?AttributeError:'模块'对象没有属性'inet_pton'
import web
urls = ('/','Index',
)
class Index:
def GET(self):
return "Hello,world!"
app=web.application(urls,globals())
if __name__=="__main__":
app.run()
Traceback (most recent call last):
File "C:\Users\Jay\workspace\test3\test2.py", line 13, in <module>
app.run()
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'
https://github.com/kinverarity1/webpy/commit/3706180f4ee3f3ac7621a513fc7fd84ba851cf3e 需要更改net.py中的第33行: 除了socket.error: 至: except(socket.error,AttributeError): – Jay42