[Pythonmac-SIG] Line endings and readline()

Gordon Worley redbird@rbisland.cx
Thu, 7 Sep 2000 16:10:57 -0400


>>I am trying to run a macpython script on a linux box, but when I try and
>>readline() from a saved text file, it gets confused about line endings ( the
>>text files are generated on a mac ).
>>
>>Is there some easy way of convincing python to change what it expects as the
>>end-of-line character, to deal with this sort of crodd-platform problem?

If you can get to the files before they are read (e.g. a human types 
them in, etc.) on the Linux box, take them into BBEdit (the lite 
version, of course, unless you happen to have paid for the full 
thing) and just save the file with different line endings (you can 
choose from Mac, DOS, and Unix).  Unfortunately, BBEdit is not 
scriptable, so if automation is key then the previously mentioned 
solutions will probably be best.
-- 
Gordon Worley
http://www.rbisland.cx/
mailto:redbird@rbisland.cx
PGP:  C462 FA84 B811 3501 9010  20D2 6EF3 77F7 BBD3 B003