ANNOUNCE; Try python beta

Richie Hindle richie at entrian.com
Tue Dec 20 10:27:25 EST 2005


[Richie]
> I think it's your JavaScript '\r' processing that's broken.  Certainly the
> error ("unexpected EOF while parsing") is consistent with having a \r on the
> end of the expression.

[Mike]
> Python doesn't care about the trailing newline.

That's a carriage return, not a newline:

>>> eval("1+2\r")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<string>", line 1
    1+2
      ^
SyntaxError: unexpected EOF while parsing

> My assumption is that if splitting on '\n' leaves us with one
> thing, we may have gotten a string that used \r for newlines

Ah, OK.  Your comment talks about DOS - that won't happen on DOS (or
Windows) which uses \r\n.  I don't know about the Mac.  But the \r\n pair
isn't handled by your code - strip() on the server side will make it work if
that's the problem:

>>> eval("1+2\r".strip())
3

-- 
Richie Hindle
richie at entrian.com



More information about the Python-list mailing list