"TypeError: read-only buffer, None" returned from file.write...

Adam Ruth aruth at intercation.com
Tue Jun 20 20:34:28 EDT 2000


I get this all the time too, simple error.  Somewhere you assigned sBuffer
to None.  It happens to me a lot when I call functions that return strings
or return None when there is a problem.  You can confirm this by writing:

f.write(str(sBuffer))

The file then should contain the word 'None'.

--
Adam Ruth
InterCation, Inc.
www.intercation.com


"Dag Sunde" <dag at orion.no> wrote in message
news:MIS35.664$PQ4.13634 at news1.online.no...
> I have the following code-snippet that retuns a string:
>
>    result = m_XMLDoc.transformNode(xslDoc)
>
> ...and the string shows the expected result when printed,
> but when I try to save the string to a file with the following
> code:
>
>   f = open( outFile, 'w')
>   f.write(sBuffer)
>   f.close()
>
> I get this error:
>
> Traceback (innermost last):
>   File "f:/apache/cgi-bin/getfinalconfirmation.py", line 142, in
> saveConfirmedData
>     f.write(sBuffer)
> TypeError: read-only buffer, None
>
> Can anyone give me a hint?
>
> TIA...
>
> Dag Sunde
>
>
>





More information about the Python-list mailing list