[PythonCE] Weird Error

Voidspace mike at pcblokes.com
Fri Oct 24 10:31:38 EDT 2003


Hmm... bugger.
I'm sure the same code ran fine on 2.2.3 for pocketpc though.
This code certainly runs fine on the desktop version of windows......... 
and it'll be a pain if I have to put another work around for 
pocketpc.........

Hohum......
Anyway - I'll try it and elt you know... thanks.

Fuzzy

Alan Kennedy wrote:

>Voidspace wrote:
>
>  
>
>>Why does python 2.3 on the pocketPC think that 'w' is an invalid IO mode ?
>>    
>>
>
>I don't know the solution for sure, but here's a theory.
>
>Microsoft operating systems tend to do character translation on input
>and output streams. In python 2.3 on win2k, when writing a text file,
>the C runtime libraries translate all '\n' to '\r\n', the DOS
>end-of-line terminator. To open a file in text mode, you open with a
>mode of either "rt" or "wt".
>
>If one wants to open a file in "binary" mode, where the '\n' to '\r\n'
>translation should not be done, then one uses modes 'rb' or 'wb'.
>
>So maybe the mode of 'w' is fine, but the MS runtime library might be
>insisting that you specify either binary or text mode. So try
>
>self.outputfile = open(outputpath, 'wt') # or 'wb'
>
>I could be completely wrong though ;-)
>
>And of course, *nix doesn't have these problems, because '\n' stays
>represented by a single character in text files. So using modes "w",
>"wb" and "wt" should all be equivalant on *nix.
>
>Al.
>
>
>_______________________________________________
>PythonCE mailing list
>PythonCE at python.org
>http://mail.python.org/mailman/listinfo/pythonce
>
>
>
>  
>

-- 

http://www.Voidspace.org.uk 
The Place where headspace meets cyberspace. Online resource site - covering science, technology, computing, cyberpunk, psychology, spirituality, fiction and more. 

---
http://groups.yahoo.com/group/atlantis_talk/
The Atlantibot coding message group.
---
http://www.atlantibots.org.uk
http://www.learnlandrover.com
http://www.fuchsiashockz.co.uk   
http://groups.yahoo.com/group/void-shockz
---

Everyone has talent. What is rare is the courage to follow talent
 to the dark place where it leads. -Erica Jong
Ambition is a poor excuse for not having sense enough to be lazy.
         -Milan Kundera







More information about the PythonCE mailing list