[Zope-CMF] Python Script Line Endings

Chris Withers chrisw@nipltd.com
Fri, 22 Jun 2001 14:50:02 +0100


Dieter Maurer wrote:
> 
> Python Script should not choke on them, but maybe, they
> do somehow.

In my experience it's if you use a file with windows line endings on unix or
vice versa.
Python is a little too clever IMVH(umble)O.

I'd still love to know why it cares about the line endings so much. 
Surely the following would solve the problem?

source # the input source
import re
CRLF=re.compile('\r\n|\n\r')    

clean_source = CRLF.sub('\n',source)

cheers,

Chris