Помогите!!! Раньше уже не раз писал веб-сервера, но было ето давно, подзабыл немного, содрал с нета пример: Цитата | from twisted.internet import reactor from twisted.web2 import server, resource, channel, http import webbrowser PORT = 8080 class Page(resource.Resource): addSlash = True def render(self, ctx): return http.Response(stream=""" <html><body><h1>This is the HTML body</h1></body></html> """)
s = server.Site(Page()) reactor.listenTCP(PORT, channel.HTTPFactory(s)) webbrowser.open("http://%s:%d" % ("localhost", PORT)) reactor.run()
|
А он падло не работает, что я только не делал  Вот такую ошибку выдает: Цитата | Traceback (most recent call last): File "H:\kursak\web-server.py", line 2, in ? from twisted.web2 import server, resource, channel, http File "C:\Python24\lib\site-packages\twisted\web2\server.py", line 30, in ? from twisted.web2 import http, iweb, fileupload File "C:\Python24\lib\site-packages\twisted\web2\http.py", line 33, in ? from twisted.web2 import iweb File "C:\Python24\lib\site-packages\twisted\web2\iweb.py", line 56, in ? class IOldNevowResource(components.Interface): AttributeError: 'module' object has no attribute 'Interface'
|
|