fileobj.write(buffer(...))

Andrew Markebo flognat at flognat.myip.org
Thu Feb 22 14:45:58 EST 2001


You forgot one line, the middle line.. I think.. You have to
do the operations on an instantiated object, not the class.

>>> from cStringIO import StringIO
>>> fileobj=StringIO() 
>>> fileobj.write( buffer( 'abcd', 2 ) )

        /Andy

/ Niki Spahiev <spahievi at vega.bg> wrote:
| Is this working as expected?
| 
| >>> open( 'test', 'w' ).write( buffer( 'abcd', 2 ) )
| >>> from cStringIO import StringIO
| >>> StringIO().write( buffer( 'abcd', 2 ) )
| Traceback (innermost last):
|   File "<pyshell#4>", line 1, in ?
|     StringIO().write( buffer( 'abcd', 2 ) )
| SystemError: bad argument to internal function
| >>>   
| 
| -- 
| Best regards,
|  Niki Spahiev



More information about the Python-list mailing list