On Mon, Oct 11, 2010 at 3:59 PM, Rhodri James <rho...@wildebst.demon.co.uk>wrote:
> On Mon, 11 Oct 2010 10:37:09 +0100, bussiere bussiere <bussi...@gmail.com> > wrote: > > > i've looked on the web and here but i didn't find an answer : here is my >> code >> >> zlib.decompress(""" >> xワᆳヤ=ラᄇHナs~Ʀᄑç\ムîà >> z...@ÑÁÔqÇlxÇÆïpp >> ~ýVãì゙M6ÛÐ|ê֭ᄁᄂヤ=)}éÓUeö3ᄎᄌú"}ʿïÿ÷1þ8ñ́U÷ᄏñíLÒVi:`ᄈᄎL!Ê҆p6-%Fë^ヘ÷à,Q.K!ユô`ÄA!ÑêweÌ >> ÊÚAロYøøÂjôóᅠÂcñ䊧fᆴùテúN >> >> :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 >> ᄐïc枢í%Èï!フᄋëiq*ᄌVKÐNᄡ[ᄁfOq{OᆭÆÊ,0GᄂリmtツᄈOᄌΥ$#îヘqbYᄆメUニᄉÞáP` >> ヨ×ᆵÃPwaレǩâ×)ハFcêÚ=!Åöᄊ >> )AFñᄈ/cMᄃ!NóNΈór?pàÜòXw >> >> 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=Ð÷èâミム'ÂÝÐ >> ;ë mᄎQÂäԤۢ:モᄆdᄎᄑLȂ1ᄈ_÷YZᆲNòÛ >> â\ロxÐlݵᆵムᆱøm5Ëá=ïoÍlMᆪ[×#Ypᅠトx[ÉÊyæツoモナz)ᆭᄀÝÏìò >> >> """) >> >> so it was a string that i got by zlib.compress an other string. How can i >> decompress this string ? >> > > 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. > 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). Option 2: Move that ugly mess out of the source and into an auxiliary data file. Option 3: Encode it in base64 and add a decoding step before the decompression step. Cheers, Ian
-- http://mail.python.org/mailman/listinfo/python-list