<div class="gmail_quote">On Mon, Oct 11, 2010 at 3:59 PM, Rhodri James <span dir="ltr"><<a href="mailto:rhodri@wildebst.demon.co.uk">rhodri@wildebst.demon.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

On Mon, 11 Oct 2010 10:37:09 +0100, bussiere bussiere <<a href="mailto:bussiere@gmail.com" target="_blank">bussiere@gmail.com</a>><br>
wrote:<div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
i've looked on the web and here but i didn't find an answer : here is my<br>
code<br>
<br>
zlib.decompress("""<br>
xワᆳヤ=ラᄇHナs~Ʀᄑç\ムîà<br>
Z@ÑÁÔQÇlxÇÆïPP~ýVãì゙M6ÛÐ|ê֭ᄁᄂヤ=)}éÓUe﬿ö3ᄎᄌú"}ʿïÿ÷1þ8ñ́U÷ᄏñíLÒVi:`ᄈᄎL!Ê҆p6-%Fë^ヘ÷à,Q.K!ユô`ÄA!ÑêweÌ<br>
ÊÚAロYøøÂjôóᅠÂcñ䊧fᆴùテúN<br>
:nüzAÝ7%ᄌcdUタᄌ3ôPۂタlンyHᆲᄑ$/yzᄒíàヌ'ÕÓ&`|S!<'ᄂ÷Zļᄐ2ホモ;ニ(ÅÛfb!úü$ナテᄒ,9ßhàPᄎᄄێフÑbØὛホQᄍ-Ü}(n;ᄄホLヤ\^ï9ᆭᄍラDdВéÞ|åPOGᄂÐÙ%â&AÔë)ÎTÐC<br>
ᄐïc枢í%Èï!フᄋëiq*ᄌVKÐNᄡ[ᄁfOq{OᆭÆÊ,0GᄂリmtツᄈOᄌΥ$#îヘqbYᄆメUニᄉÞáP`<br>
ヨ×ᆵÃPwaレǩâ×)ハFcêÚ=!Åöᄊ<br>
)AFñᄈ/cMᄃ!NóNΈór?pàÜòXw<br>
Bvæ0ïçIÉoマ>5pᆭ-ØWÚNᄆùFᄆØPçÃþdᅠ;ル1[Oᄈホ~6ツᄈᆬŕìᄄޠ=øð@ネV﾿ᄅ)÷%ユÜib{HᄆKŅVlDCテîfÑWì÷ìáár.ワîv﾿<dᄎn~ú*ÁÕ7ýá}EsYᆵWᄂÈ:R×ãQңメ?Ø1vヘäツ~èR1ᄉÜ*ᄡónAᆬjmNoツユᄈÌښᆬf[8ᆭÛ>゙OWラ|ÌbDᄁÖ녡M=Ð÷èâミム'ÂÝÐ<br>
;ë mᄎQÂäԤۢ:モᄆdᄎᄑLȂ1ᄈ_÷YZᆲNòÛ<br>
â\ロxÐlݵᆵムᆱøm5Ëá=ïoÍlMᆪ[×#Ypᅠトx[ÉÊyæツoモナz)ᆭᄀÝÏìò<br>
<br>
""")<br>
<br>
so it was a string that i got by zlib.compress an other string. How can i<br>
decompress this string ?<br>
</blockquote>
<br></div></div>
It helps to say what your problem is more explicitly than just hinting at it in the title.  Assuming that you are running on Windows and the Python traceback really does single this line out, my guess is that one of those random binary characters is a Ctrl-Z.  Windows regards that as the end of a text file.  How you get out of that one, I'm not sure, but frankly putting arbitrary binary into a literal string is rather asking for something like this to come and bite you.<br>

</blockquote></div><br>Option 1: Replace the binary bytes with the proper escape codes (incidentally, I see some backslashes already in there that most likely also need to be escaped).<br><br>Option 2: Move that ugly mess out of the source and into an auxiliary data file.<br>

<br>Option 3: Encode it in base64 and add a decoding step before the decompression step.<br><br>Cheers,<br>Ian<br>