This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: fileinput does not use universal input
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, georg.brandl, reowen
Priority: normal Keywords:

Created on 2003-12-15 19:11 by reowen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg19417 - (view) Author: Russell Owen (reowen) Date: 2003-12-15 19:11
In Python 2.3.0 the fileinput module does not appear to use universal line ending mode for reading files. I found this using MacPython 2.3 (via the binary installer) but looking at the module it appears to be vanilla code. I confess I didn't see where the files were opened, so I cannot suggest a fix.

Sample code:

import fileinput
for line in fileinput.input():
	print line[0:20]

try this with text files that have some other platform's line endings. For me, it works on MacOS X for files with unix line endings, but fails if the file(s) have Mac line endings.
msg19418 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-05-31 21:42
Logged In: YES 
user_id=1188172

See patch #1212287.
msg19419 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-02-20 20:06
Logged In: YES 
user_id=849994

Patch #1212287 was now committed, so closing this.
History
Date User Action Args
2022-04-11 14:56:01adminsetgithub: 39710
2003-12-15 19:11:32reowencreate