[Twisted-Python] Re: How do I run a twisted server directly

Alexander May alex-news at comcast.net
Mon May 17 18:07:47 EDT 2004


> 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=547
0&atid=105470).

Thanks for the info.  I'm running Python 2.3.3.  It does still appear to be
an issue with python and not twisted.

C:\Documents and Settings\Alexander May\My
Documents\maygold-dev\central-server>python
Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> c=compile ('print "hello world"\n', 'filename', 'exec')
>>> exec c
hello world
>>> c=compile ('print "hello world"\n ', 'filename', 'exec')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "filename", line 2

SyntaxError: invalid syntax
>>> ^Z

Alex


-----Original Message-----
From: twisted-python-bounces at twistedmatrix.com
[mailto:twisted-python-bounces at twistedmatrix.com] On Behalf Of David Bolen
Sent: Monday, May 17, 2004 3:54 PM
To: twisted-python at twistedmatrix.com
Subject: [Twisted-Python] Re: How do I run a twisted server directly

"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=547
0&atid=105470).

-- David


_______________________________________________
Twisted-Python mailing list
Twisted-Python at twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list