newbie file writing

Adrian Eyre a.eyre at optichrome.com
Tue Mar 7 09:41:34 EST 2000


> inbox = open('inbox','w')
> tempinbox = server.retr(numMsgs)

This function is returning None.

> inbox.write(tempinbox)
> 
> I get the following error:
> 
> Traceback (innermost last):
>   File "<input>", line 1, in ?
> TypeError: read-only buffer, None

as it says here.

Change it to something like:

tempinbox = server.retr(numMsgs)
if not tempinbox is None:
	assert type(tempinbox) == type("")
	open('inbox', 'w').write(tempinbox)

-----------------------------------------------------------------
Adrian Eyre <a.eyre at optichrome.com> - http://www.optichrome.com 





More information about the Python-list mailing list