[issue38740] Line count mis match between open() vs sys.stdin api calls

2019-11-08 Thread Thamme Gowda
Thamme Gowda added the comment: Thanks for the quick response. Yes ``newline="\n"`` fixed it. So it as a known behavior. (I was tempted to consider it as a bug since the behavior differed from sys.stdin) Thank you. -- ___ Python tracker

[issue38740] Line count mis match between open() vs sys.stdin api calls

2019-11-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: This seems to be the difference between Universal Newlines or not. In Python 2, you have to set it explicitly with a U in the open mode: $ python2.7 -c 'import sys; print("Linecount=", sum(1 for x in open(sys.argv[1], "Ur")))' line_break_err.txt ('L

[issue38740] Line count mis match between open() vs sys.stdin api calls

2019-11-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Try to add newline="\n" in open(). -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python

[issue38740] Line count mis match between open() vs sys.stdin api calls

2019-11-07 Thread Thamme Gowda
Change by Thamme Gowda : Added file: https://bugs.python.org/file48702/line_break_err.txt ___ Python tracker ___ ___ Python-bugs-list mailin

[issue38740] Line count mis match between open() vs sys.stdin api calls

2019-11-07 Thread Thamme Gowda
New submission from Thamme Gowda : I ran into a line count mismatch bug and I narrowed it down to 9 lines where the line break handling is causing an issue. Please find the attachment named line_break_err.txt to reproduce the below. $ md5sum line_break_err.txt 5dea501b8e299a0ece94d859777285