Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8744 > unrolled thread
| Started by | amir chaouki <chaouki.amir@gmail.com> |
|---|---|
| First post | 2011-07-03 16:41 -0700 |
| Last post | 2011-07-03 21:57 -0300 |
| Articles | 12 — 11 participants |
Back to article view | Back to comp.lang.python
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
| From | amir chaouki <chaouki.amir@gmail.com> |
|---|---|
| Date | 2011-07-03 16:41 -0700 |
| Subject | Problem!! |
| Message-ID | <fa5036fe-ae67-4860-9f78-9469ad0c7b49@g12g2000yqd.googlegroups.com> |
i have written code on linux for parsing text files and it works great but when i try to run it on windows it goes crazy, do you have any idea???
[toc] | [next] | [standalone]
| From | Irmen de Jong <irmen.NOSPAM@xs4all.nl> |
|---|---|
| Date | 2011-07-04 01:47 +0200 |
| Message-ID | <4e10ff9b$0$21805$e4fe514c@news2.news.xs4all.nl> |
| In reply to | #8744 |
On 4-7-2011 1:41, amir chaouki wrote: > i have written code on linux for parsing text files and it works great > but when i try to run it on windows it goes crazy, do you have any > idea??? No, I misplaced my crystal ball. Irmen P.S. http://www.catb.org/~esr/faqs/smart-questions.html
[toc] | [prev] | [next] | [standalone]
| From | TheSaint <nobody@nowhere.net.no> |
|---|---|
| Date | 2011-07-04 15:16 +0800 |
| Message-ID | <iurpci$r2g$1@speranza.aioe.org> |
| In reply to | #8745 |
Irmen de Jong wrote: > No, I misplaced my crystal ball. I'm waiting mine, brand new in HD :D, with remote control :D :D -- goto /dev/null
[toc] | [prev] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2011-07-04 20:48 +1200 |
| Message-ID | <97dd2jFfs7U1@mid.individual.net> |
| In reply to | #8756 |
TheSaint wrote: > On 4-7-2011 1:41, amir chaouki wrote: > >> No, I misplaced my crystal ball. > > I'm waiting mine, brand new in HD :D, with remote control :D :D The new digital models are great. But there's a distressing tendency for visions to come with DRM protection these days, so you can only share them with at most 5 other users. :-( -- Greg
[toc] | [prev] | [next] | [standalone]
| From | rantingrick <rantingrick@gmail.com> |
|---|---|
| Date | 2011-07-03 16:54 -0700 |
| Message-ID | <62eb70bd-a15a-4ae2-8251-724d75ba77c4@fq4g2000vbb.googlegroups.com> |
| In reply to | #8744 |
On Jul 3, 6:41 pm, amir chaouki <chaouki.a...@gmail.com> wrote: > i have written code on linux for parsing text files and it works great > but when i try to run it on windows it goes crazy, do you have any > idea??? psst: you should show us the code first. :)
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-07-04 09:54 +1000 |
| Message-ID | <mailman.590.1309737271.1164.python-list@python.org> |
| In reply to | #8744 |
On Mon, Jul 4, 2011 at 9:41 AM, amir chaouki <chaouki.amir@gmail.com> wrote: > i have written code on linux for parsing text files and it works great > but when i try to run it on windows it goes crazy, do you have any > idea??? If you share your code, we may be able to help. Alternatively, here's a few differences to look at: 1) Filenames - if you have a literal for your file name, "/home/foobar/file" will work, but "c:\path\newfile.txt" won't - backslash is a special character. Make it a raw string: r"c:\path\newfile.txt" - that will work. 2) End of line characters. If you divide the contents of the file on the "\n" character, and then try to work with the end of each line, you may find that the string has a "\r" character at the end. 3) What Irmen de Jong said. :) Chris Angelico
[toc] | [prev] | [next] | [standalone]
| From | amir chaouki <chaouki.amir@gmail.com> |
|---|---|
| Date | 2011-07-03 16:58 -0700 |
| Message-ID | <07867699-7031-4337-abb0-7aa339fc418f@x10g2000vbl.googlegroups.com> |
| In reply to | #8747 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2011-07-05 09:30 +1000 |
| Message-ID | <4e124d06$0$29973$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #8748 |
amir chaouki wrote: > the problem is when i use the seek function on windows it gives me > false results What do you mean "false results"? What does this even mean? Please show us: * what you do * what result you expect * what result you actually get -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Nobody <nobody@nowhere.com> |
|---|---|
| Date | 2011-07-05 09:14 +0100 |
| Message-ID | <pan.2011.07.05.08.14.12.665000@nowhere.com> |
| In reply to | #8748 |
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).
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2011-07-04 10:12 +1000 |
| Message-ID | <87liwekior.fsf@benfinney.id.au> |
| In reply to | #8744 |
amir chaouki <chaouki.amir@gmail.com> writes: > i have written code on linux for parsing text files and it works great > but when i try to run it on windows it goes crazy, do you have any > idea??? Please compose a new message, with a descriptive ‘Subject’ field, example code that we can run, and your expectations for what the code should do. -- \ “In general my children refuse to eat anything that hasn't | `\ danced on television.” —Erma Bombeck | _o__) | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2011-07-04 00:34 +0000 |
| Message-ID | <iur1pu$mhb$1@reader1.panix.com> |
| In reply to | #8744 |
On 2011-07-03, amir chaouki <chaouki.amir@gmail.com> wrote:
> i have written code on linux for parsing text files and it works great
> but when i try to run it on windows it goes crazy, do you have any
> idea???
Yes.
--
Grant Edwards grant.b.edwards Yow! LOOK!! Sullen
at American teens wearing
gmail.com MADRAS shorts and "Flock of
Seagulls" HAIRCUTS!
[toc] | [prev] | [next] | [standalone]
| From | milosh zorica <miloshzorica@gmail.com> |
|---|---|
| Date | 2011-07-03 21:57 -0300 |
| Message-ID | <mailman.591.1309741046.1164.python-list@python.org> |
| In reply to | #8750 |
filenames and the crlf / eof thing come to my mind first linux and windows handle files all different On Sun, Jul 3, 2011 at 9:34 PM, Grant Edwards <invalid@invalid.invalid> wrote: > On 2011-07-03, amir chaouki <chaouki.amir@gmail.com> wrote: > >> i have written code on linux for parsing text files and it works great >> but when i try to run it on windows it goes crazy, do you have any >> idea??? > > Yes. > > -- > Grant Edwards grant.b.edwards Yow! LOOK!! Sullen > at American teens wearing > gmail.com MADRAS shorts and "Flock of > Seagulls" HAIRCUTS! > -- > http://mail.python.org/mailman/listinfo/python-list > -- Milosh Zorica http://www.linkedin.com/in/miloshzorica | www.coroflot.com/miloshz http://tangoinabox.co.uk Tango in a Box - Online Media Production, the Tango Principles Applied - Born in Argentina, Growing up Globally +1 310 601 4396 | +44 20 8144 5294 | +54 9 11 3515 7187
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web