[Twisted-Python] How do I run a twisted server directly
Alexander May
alex-news at comcast.net
Sat May 15 07:10:45 MDT 2004
Thanks.
FYI - When I did this I stumbled on to something. If I have scratch.py as
follows:
from twisted.application import service
application = service.Application('central-server')
Where the last line consists of a single space, then I get an error when I
run twistd -y scratch.py (call stack at end). When I remove the space so
the last line is just a carriage return, it works fine. I found it strange.
Perhaps it is a python thing I has just never stumbled on before. Not a big
deal now that I know, but it drove me batty for a bit.
Also, why the preference for .tac extensions when running twistd, instead of
.py?
I'm slowly working my way through the docs, so if it's RTFM, I'll
understand.
Thanks again for all the help,
Alex
Call stack:
Traceback (most recent call last):
File "C:\Python23\scripts\twistd.py", line 36, in ?
run()
File "C:\Python23\Lib\site-packages\twisted\scripts\twistw.py", line 61,
in run
app.run(runApp, ServerOptions)
File "C:\Python23\Lib\site-packages\twisted\application\app.py", line 204,
in run
runApp(config)
File "C:\Python23\Lib\site-packages\twisted\scripts\twistw.py", line 45,
in runApp
application = app.getApplication(config, passphrase)
--- <exception caught here> ---
File "C:\Python23\Lib\site-packages\twisted\application\app.py", line 117,
in getApplication
application = service.loadApplication(filename, style, passphrase)
File "C:\Python23\Lib\site-packages\twisted\application\service.py", line
291, in loadApplication
application = sob.loadValueFromFile(filename, 'application', passphrase)
File "C:\Python23\Lib\site-packages\twisted\persisted\sob.py", line 213,
in loadValueFromFile
exec data in d, d
exceptions.SyntaxError: invalid syntax (line 5)
Failed to load application: invalid syntax (line 5)
More information about the Twisted-Python
mailing list