[Twisted-Python] some demo scripts
![](https://secure.gravatar.com/avatar/3ca06b70d042e66f2d1835d698d290a5.jpg?s=120&d=mm&r=g)
Hello all, i started playing with twisted python 0.7.2 and it looks very interesting. I tried to go along the 'philosophical tutorial to Twisted Python ' and created 4 little python-scripts on the way which initialize and use the minimalist telnet- and web-server. They run under windows nt and python 2 but should be portable. Under Windows NT a start of the servers gives an attribute error because os.getgid() is nit implemented. I suppressed this message under NT : line 975 sqq on \twisted\net.py could read : except: if os.name == 'nt': pass else : traceback.print_exc(file=sys.stdout) print 'setuid/gid failed' Enjoy Norbert Klamann Norbert Klamann ++ ++ Klamann Software & Beratung GmbH ++ Franz-Marc-Str.174 ++ D-50374 Erftstadt ++ Tel.: 02235 / 985272 ++ Fax: 02235 / 985273 ++ Mobil : 0172 / 2797723 ++ PGP Fingerprint : ++ 05CC 4362 E765 51F1 38D9 C43F D907 B4D8 7873 3454 from twisted import threadable threadable.init(0) from cPickle import load selector = load(open('twistd_web.spl')) from twisted import web myTest = web.Test() selector.servers[0].root.putChild('test',myTest) selector.run() from cPickle import dump dump(selector) from twisted import threadable threadable.init(0) from cPickle import load selector = load(open('twistd.spl')) selector.run() from twisted import threadable threadable.init(0) from twisted import net selector = net.Selector() from twisted import web server = web.Server(8181, selector) documentRoot = web.File('.') server.setRoot(documentRoot) server.startUp() from cPickle import dump dump(selector, open('twistd_web.spl','wb')) from twisted import threadable threadable.init(0) from twisted import net selector = net.Selector() from twisted import telnet server = telnet.Server(4040, selector) from cPickle import dump dump(selector, open('twistd.spl','wb'))
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
Hello Norbert, The scripts you wrote are mostly like the ones found in bin/ -- mkwebserver and mktelnetserver. Have a look at them; there are a number of options they offer. I'm sorry these weren't covered in the tutorial, but I haven't had that much time to work on documentation. Thank you much for your interest, though! Those log messages about setuid and setgid will be supressed under NT in the future. On Wed, 14 Mar 2001, Norbert Klamann wrote:
______ __ __ _____ _ _ | ____ | \_/ |_____] |_____| |_____| |_____ | | | | @ t w i s t e d m a t r i x . c o m http://www.twistedmatrix.com/~glyph/
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
Hello Norbert, The scripts you wrote are mostly like the ones found in bin/ -- mkwebserver and mktelnetserver. Have a look at them; there are a number of options they offer. I'm sorry these weren't covered in the tutorial, but I haven't had that much time to work on documentation. Thank you much for your interest, though! Those log messages about setuid and setgid will be supressed under NT in the future. On Wed, 14 Mar 2001, Norbert Klamann wrote:
______ __ __ _____ _ _ | ____ | \_/ |_____] |_____| |_____| |_____ | | | | @ t w i s t e d m a t r i x . c o m http://www.twistedmatrix.com/~glyph/
participants (2)
-
Glyph Lefkowitz
-
Norbert Klamann