Bugs item #1450456, was opened at 2006-03-15 10:17 Message generated for change (Comment added) made by object You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1450456&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Windows Group: Python 2.4 >Status: Deleted Resolution: Invalid Priority: 5 Submitted By: tom berger (object) Assigned to: Nobody/Anonymous (nobody) Summary: windows python truncates files when reading them Initial Comment: when using python for windows, opening a file and calling read() on the file object returns only some of the file (about 1K). i am expecting read to return the entire contents of the file (and this is what i get when i run the same code on cygwin and linux). to reproduce: prepare a sufficiently large file myfile.xxx (say > 100K) source = open('myfile.xxx', 'r') dest = open('copy_myfile.xxx', 'w') dest.write(source.read()) source.close() dest.close() myfile.xxx and copy_myfile.xxx should be identical, and they are if you run this on most python distributions. when running the version installed from the .msi installer on python.org the copy is truncated (as part of reading, i'm pretty sure). ---------------------------------------------------------------------- >Comment By: tom berger (object) Date: 2006-03-15 10:36 Message: Logged In: YES user_id=110577 yes, of course. ---------------------------------------------------------------------- Comment By: Georg Brandl (gbrandl) Date: 2006-03-15 10:22 Message: Logged In: YES user_id=849994 I'm guessing here, but the only conclusion is that you are reading a binary file. Since Windows makes a difference between text and binary files, you must read the file with mode 'rb', or Windows will stop at the first chr(26) == Ctrl+Z == EOF. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1450456&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com