<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Sprechblasentext Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.SprechblasentextZchn
        {mso-style-name:"Sprechblasentext Zchn";
        mso-style-priority:99;
        mso-style-link:Sprechblasentext;
        font-family:"Tahoma","sans-serif";}
span.pre
        {mso-style-name:pre;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The code for "getTraceback"<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><a href="http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/python/failure.py#L529">http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/python/failure.py#L529</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>uses a native version of StringIO<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><a href="http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/python/failure.py#L23">http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/python/failure.py#L23</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>However, cStringIO:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>"Unlike the <a href="http://docs.python.org/2/library/stringio.html#module-StringIO" title="StringIO: Read and write strings as if they were files."><span class=pre><span style='font-size:10.0pt;font-family:"Courier New";color:blue'>StringIO</span></span></a> module, this module is not able to accept Unicode strings that cannot be encoded as plain ASCII strings."<o:p></o:p></p><p class=MsoNormal><a href="http://docs.python.org/2/library/stringio.html#module-cStringIO">http://docs.python.org/2/library/stringio.html#module-cStringIO</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Above situation triggers an exception when the traceback includes non-ASCII Unicode strings:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>"""<o:p></o:p></p><p class=MsoNormal>'unicode' does not have the buffer interface<o:p></o:p></p><p class=MsoNormal>"""<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I have worked around this by implementing my own "getTraceback" that uses standard (non-native) StringIO. Works.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Should I file a bug?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>/Tobias<o:p></o:p></p></div></body></html>