[Pythonmac-SIG] Line endings and readline()

Just van Rossum just@letterror.com
Wed, 6 Sep 2000 08:10:48 +0100


At 11:50 PM +0200 05-09-2000, Jack Jansen wrote:
>There are some cases where it can be useful, but in general you should
>leave this to whoever did the transfer from mac to unix or
>vice-versa. After all Python isn't the only Unix program that'll have
>trouble with Mac line endings: all unix programs will. FTP clients,
>archivers, and remote file server packages will usually do the
>conversion for you if you set them up correctly. And on the Mac this
>should be a breeze because all files of type TEXT should be translated
>(unix and windows programs will have to gues whether a file is text
>based on the extension, so you'll have to do the correct setup there
>yourself).

What about the situation where you want to mount a Unix volume? It's really
irksome to share code between Mac and Unix this way: you don't really
*want* conversion, you just want it to *work* on both platforms...

I understand a similar problem exists under Windows, but at least Python on
Windows is able to correctly handle text files which have \n instead of
\r\n line endings. I sometimes wish MacPython would simply accept \n files.
It not doing so leads to funny problems, as we've seen recently: a unix
file starting with a #! line will run just fine on the Mac: it simply does
nothing... (everything is hidden behind that initial comment.)

I don't know what would be the best solution; I'm so much used to dealing
with this problem that I hardly ever think about it anymore.

Just