I am starting migration process from python to jython. Has anyone done this with ease before?
What are the gotchas? Should I build first inside Jython IDE then deploy or what?
I am starting migration process from python to jython. Has anyone done this with
Share
Keep in mind that in jython, while running under Java everything thing is ‘Big-Endian’ no matter what platform you’re on, whereas on a PC/Linux/Mac(x86) platform python is Little Endian. Make sure that when you’re using struct.pack and struct.unpack you use the appropriate prefix
without prefix
write data (enessw.py)
read data (enessr.py)
Results
Write with python, read with jython
Write with jython read with python
The Fix
Use the < in the format string for pack and unpack. This will instruct pack/unpack that the data is to be specifically little endian in format.
With ‘<IIII’ as pack/unpack format
References
struct.pack