[Twisted-Python] Re: How do I run a twisted server directly
db3l at fitlinxx.com
Mon May 17 15:54:18 EDT 2004
"Alexander May" <alex-news at comcast.net> writes:
> 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.
It sounds like an existing Python issue having to do with the internal
compile function (which is also used by exec) not handling the case of
a file not terminating in a newline. Programs that bring in modules
as text and then compile them can run into this (it used to happen to
me with the Installer package). So it's not really something related
to twisted other than how it accesses the module specified with -y. I
guess since as of Python 2.2, compile/exec is documented as needing
the newline you might argue twistd should be taking care of that. And
yes, the fact that it shows up as a bland SyntaxError is not obvious.
This got fixed as part of SourceForge bug 501622. The fix showed up
in Python 2.3. (See also http://sourceforge.net/tracker/index.php?func=detail&aid=501622&group_id=5470&atid=105470).
More information about the Twisted-Python