I'll have to try this again.  I obviously did something wrong in my code.  I was
getting errors about not being able to write a string because it wasn't
supported.  It was driving me nuts for a while until I just gave up and went
back to open().  I'll do some more playing and if I continue to get errors, I'll
post the code I'm using at the time along with any errors I got.

I apologize for not including the details.  A thread I was reading reminded me
about that odd behaviour from a couple of weeks ago and I wanted to see if I was
way off base as I could consistently reproduce it then on Python 2.4.1.

Thanks to all who replied.  If open is still preferred, I will stick with that.
:-)

-Pete

Scott David Daniels <[EMAIL PROTECTED]> wrote:

> Peter A. Schott wrote:
> > Been reading the docs saying that file should replace open in our code, but 
> > this
> > doesn't seem to work:
> This was really a misstatement; open is still preferred.  file is now
> a built in class, and its constructor is the same as open.  I think the
> current docs have been fixed.
> 
> > # Open file for writing, write something, close file
> > MyFile = file("MyFile.txt", "w")
> > MyFile.write("This is a test.")
> > MyFile.close()
> But you've given us no idea what went wrong.
> 
> > However, using:
> > MyFile = open("MyFile.txt", "w")
> > MyFile.write("This is a test.")
> > MyFile.close()
> I cannot help you if you don't tell me what went wrong.
> 
> Both bits of code seem to do the same thing for me.
> 
> 
> --Scott David Daniels
> [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to