Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8815
| From | Nobody <nobody@nowhere.com> |
|---|---|
| Subject | Re: Problem!! |
| Date | 2011-07-05 09:14 +0100 |
| Message-Id | <pan.2011.07.05.08.14.12.665000@nowhere.com> |
| Newsgroups | comp.lang.python |
| References | <fa5036fe-ae67-4860-9f78-9469ad0c7b49@g12g2000yqd.googlegroups.com> <mailman.590.1309737271.1164.python-list@python.org> <07867699-7031-4337-abb0-7aa339fc418f@x10g2000vbl.googlegroups.com> |
| Organization | Zen Internet |
On Sun, 03 Jul 2011 16:58:24 -0700, amir chaouki wrote: > the problem is when i use the seek function on windows it gives me > false results other then the results on *ux. the file that i work with > are very large about 10mb. This is probably an issue with how the underlying C functions behave on Windows, related to the CRLF<->LF conversions when a file is opened in text mode. The Python library documention for the .seek() method says: > If the file is opened in text mode (without 'b'), only offsets returned > by tell() are legal. Use of other offsets causes undefined behavior. IOW, you can't use computed offsets with files opened in text mode (although in practice this will work for platforms other than Windows). If you want to use computed offsets, open the file in binary mode and strip the trailing CRs yourself. And 10MB isn't "very large"; it's not even "large". You normally only start running into problems with files which are 2GiB (2,147,483,648 bytes) or more (i.e. if you can't fit the size into a signed 32-bit integer).
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Problem!! amir chaouki <chaouki.amir@gmail.com> - 2011-07-03 16:41 -0700
Re: Problem!! Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2011-07-04 01:47 +0200
Re: Problem!! TheSaint <nobody@nowhere.net.no> - 2011-07-04 15:16 +0800
Re: Problem!! Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-04 20:48 +1200
Re: Problem!! rantingrick <rantingrick@gmail.com> - 2011-07-03 16:54 -0700
Re: Problem!! Chris Angelico <rosuav@gmail.com> - 2011-07-04 09:54 +1000
Re: Problem!! amir chaouki <chaouki.amir@gmail.com> - 2011-07-03 16:58 -0700
Re: Problem!! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-05 09:30 +1000
Re: Problem!! Nobody <nobody@nowhere.com> - 2011-07-05 09:14 +0100
Re: Problem!! Ben Finney <ben+python@benfinney.id.au> - 2011-07-04 10:12 +1000
Re: Problem!! Grant Edwards <invalid@invalid.invalid> - 2011-07-04 00:34 +0000
Re: Problem!! milosh zorica <miloshzorica@gmail.com> - 2011-07-03 21:57 -0300
csiph-web