Question

When I run this, or any webpy program I get the below error. I have tried different names, like test.py, and server.py. 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!"

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'
Was it helpful?

Solution

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

More information here.

OTHER TIPS

  1. Install win inet pton using terminal or cmd
  2. Run pip install win-inet-pton
  3. In the project code write: import win_inet_pton

Changing the line 33 in net.py from:

except socket.error:

to

except (socket.error, AttributeError)

perfectly works for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top