Interpreter fussy about line endings?

Guido van Rossum guido at eric.cnri.reston.va.us
Tue May 4 11:00:18 EDT 1999


Greg Ewing <greg.ewing at compaq.com> writes:

> Python 1.5.1 on my Mac refuses to run code
> written using PythonWin's built-in editor,
> apparently because of different CR/LF 
> conventions. I have to load it into Alpha
> and save it in Mac format before it will
> work!
> 
> Is it meant to be like this? Why should
> it care? How is one supposed to write
> cross-platform Python code if it does
> things like this?

Python (by virtue of the C stdio library) expects the line ending
convention of the platform.  Typically, file transfer utilities
(e.g. FTP) take care of translating line ending conventions for text
files.

For future versions, I may adapt the Java convention (lines are ended
by CR, LF or CRLF) but for now, you have to translate line endings
when you transfer files.  And yes, I know that is sometimes a pain.
Live with it.

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list