File-writing not working in Windows?

tdahsu at gmail.com tdahsu at gmail.com
Fri Jun 6 16:19:27 EDT 2008


On Jun 6, 2:58 pm, jay graves <jaywgra... at gmail.com> wrote:
> On Jun 6, 1:22 pm, tda... at gmail.com wrote:
>
> > I am thinking that the "g.open(tempFileName, 'a')" command is the
> > issue.  Is there anything different about opening a file in Windows?
> > Does Windows understand "append", or would I have to do control checks
> > for seeing if the file is created and then appending?
>
> Does your file have embedded nulls?
> Try opening it in binary mode.
>
> g.open(tempFileName,'ab')
>
> Note that this will turn off Universal newline support.
>
> Barring that, can you distill the problem down by writing a script
> that exhibits the behavior without the rest of your program?
>
> ...
> Jay

Jay,

This did not make a difference in my script.  However, I did what you
suggested, and tried the simple script it Windows, and it works as it
should.

(It's really annoying because it works on the Mac and Linux!  (I just
tested my script on the Mac as well.)  It only doesn't work on
Windows, though clearly the file processing I am doing SHOULD work.)

Now I have to find out what it is about my code that's causing the
problem...  :-(



More information about the Python-list mailing list