BytesConversion on argument fixes it: public static object b2a_base64([BytesConversion]string data)
Short term workaround, try adding str() around an argument On Wed, Aug 27, 2014 at 5:17 PM, Slide <slide.o....@gmail.com> wrote: > Can you file an issue on ironpython.codeplex.com? > > > On Wed, Aug 27, 2014 at 7:53 AM, Hernán Foffani <hfoff...@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@python.org >> https://mail.python.org/mailman/listinfo/ironpython-users >> > > > > -- > Website: http://earl-of-code.com > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users@python.org > https://mail.python.org/mailman/listinfo/ironpython-users > >
_______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users