cStringIO.StringIO has no write method?
Laszlo Nagy
gandalf at designaproduct.biz
Tue Jul 25 15:14:16 EDT 2006
This program:
import sys
import traceback
import cStringIO
a = 1.0
b = 0.0
try:
c=a/b
except:
f = cStringIO.StringIO('')
ei = sys.exc_info()
traceback.print_exception(ei[0],ei[1],ei[2],file=f)
raises this exception:
Traceback (most recent call last):
File "C:/Documents and Settings/gandalf/test.py", line 12, in ?
traceback.print_exception(ei[0],ei[1],ei[2],file=f)
File "C:\Python24\Lib\traceback.py", line 124, in print_exception
_print(file, 'Traceback (most recent call last):')
File "C:\Python24\Lib\traceback.py", line 13, in _print
file.write(str+terminator)
AttributeError: 'cStringIO.StringI' object has no attribute 'write'
What is 'cStringIO.StringI' anyway? Shouldn't it be 'cStringIO.StringIO'?
Laszlo
More information about the Python-list
mailing list