當我運行這個,或任何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