[Ironpython-users] b64encode(bz2.compress()) throws exception.

Slide slide.o.mix at gmail.com
Wed Aug 27 17:17:43 CEST 2014


Can you file an issue on ironpython.codeplex.com?


On Wed, Aug 27, 2014 at 7:53 AM, Hernán Foffani <hfoffani at gmail.com> wrote:

> Hi,
> This works on CPython but on IronPython throws an exception in
> base64.b64encode.
>
> from __future__ import print_function
>
> import cPickle
> import bz2
> import base64
>
> def serializa(o):
>    s1 = cPickle.dumps(o)
>    s2 = bz2.compress(s1)
>    s = base64.b64encode(s2)
>    return s
>
> def deserializa(s):
>    o = cPickle.loads(bz2.decompress(base64.b64decode(s)))
>    return o
>
> def procesa():
>    l1 = [23,4,303,None,'.',32023.03,0]
>    l2 = deserializa(serializa(l1))
>    print(l1, l2)
>
> procesa()
>
>
>
> C:\> ipy.exe x.py
> Traceback (most recent call last):
>  File "x.py", line 23, in <module>
>  File "x.py", line 20, in procesa
>  File "x.py", line 10, in serializa
>  File "C:\Program Files\IronPython 2.7\Lib\base64.py", line 53, in
> b64encode
> TypeError: expected str, got bytes
>
>
> Pythons:
>
> Python 2.7.8 (default, Aug 24 2014, 21:26:19)
> [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
> Type "help", "copyright", "credits" or "license" for more information
>
> IronPython 2.7.3 (2.7.0.40) on .NET 4.0.30319.18444 (32-bit)
> Type "help", "copyright", "credits" or "license" for more information.
>
>
>
> Regards,
> Hernán.
>
>
>
>
>
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> https://mail.python.org/mailman/listinfo/ironpython-users
>



-- 
Website: http://earl-of-code.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20140827/02f93b8e/attachment.html>


More information about the Ironpython-users mailing list