eval() with unicode_literals?
Paulo Costa <[email protected]>
| Newsgroups | gmane.comp.lang.jython.user |
|---|---|
| Message-ID | <CADbEYb=UVudHO6=1OVtO_zkEisYxXM54oPF7EnK_694P=Ld8mQ@mail.gmail.com> |
Hello,
First, thanks for this awesome library.
I've just started used Jython and I'm loving it :)
I'm using it inside my project to evalute some user-define expressions.
I need these expressions evaluated using unicode_literals
How can I do that?
This is what I've tried so far:
PythonInterpreter python = new PythonInterpreter();
>
>
>> //Not using unicode_literals
>
> System.out.println(python.eval("repr('é')"));
>
>
>> //Try to update the interpreter using exec - Doesn't work
>
> python.exec("from __future__ import unicode_literals");
>
> System.out.println(python.eval("repr('é')"));
>
>
>> //Import unicode_literals and print string inside exec() - Works, but
>> doesn't return a value
>
> python.exec("from __future__ import unicode_literals\nprint repr('é')");
>
>
Thanks!
------------------------------------------------------------------------------
_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users