byte[] input = new byte[] { 0x01, 0x7f, (byte) 0x80, (byte) 0xff };
jep.set("input", input);
jep.eval("print(type(input))"); // Should print: <class 'bytes'>
byte[] input = new byte[] { 0x01, 0x7f, 0x80, 0xff };
jep.set("input_pyjarray", input);
jep.eval("input = bytes(input_pyjarray)");
jep.JepException: <class 'ValueError'>: bytes must be in range(0, 256)
byte[] input = new byte[] { 0x01, 0x7f, (byte) 0x80, (byte) 0xff };
jep.set("input_pyjarray", input);
jep.eval("input = bytes(b % 256 for b in input_pyjarray)");
byte[] pythonInput = jep.getValue_bytearray("input")
Hi Krzystof,
I don't know anything about your application, but I find it much
easier to use Numpy arrays in Python than Python arrays (lists).
It is much easier to access raw data and convert or format it
however you like in Numpy. Also, Jep has good support for passing
Java native arrays into Numpy arrays and back to Java as well.
Hope this helps,
Erik
--
You received this message because you are subscribed to the Google Groups "Jep Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jep-project...@googlegroups.com.
To post to this group, send email to jep-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jep-project/4cfb7124-2944-4cb9-8e53-634d5315e942%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- ************************************************ Erik Johansson Project Manager, Wavefront Correction System National Solar Observatory Daniel K Inouye Solar Telescope 3665 Discovery Drive, Boulder, CO 80303 Tel: 303-735-7723 ************************************************
To unsubscribe from this group and stop receiving emails from it, send an email to jep-project+unsubscribe@googlegroups.com.
To post to this group, send email to jep-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jep-project/02b6c956-cba2-4760-b659-c49b0300025c%40googlegroups.com.