Execute commands from file
Douglas Woodrow
newsgroups at nospam.demon.co.uk
Fri May 18 03:15:09 EDT 2007
On Fri, 18 May 2007 04:45:30, Dennis Lee Bieber <wlfraed at ix.netcom.com>
wrote
>On 17 May 2007 13:12:10 -0700, i3dmaster <i3dmaster at gmail.com> declaimed
>the following in comp.lang.python:
>
>> 'b' is generally useful on systems that don't treat binary and text
>> files differently. It will improve portability.
>
> "b" is needed for binary files on systems that /do/ treat binary
>differently from text. And it does add to portability only in that it
>has no effect on those that treat all files the same.
>
> However, as I recall the thread, the intent is to process text lines
>from a file -- and using "b" is going to affect how the line endings are
>being treated.
Yes that was my understanding too, Dennis, and the reason I queried it
in the first place. I had to remove the "b" option in order to get the
sample code to work under Windows, because the standard line termination
under Windows is carriage return + linefeed (\r\n).
Of course if I manually edit the command file so that it only has a
linefeed character at the end of each line, the binary mode works.
So I think i3dmaster's method is only portable as long as the command
file is created with unix-style line termination.
--
Doug Woodrow
More information about the Python-list
mailing list