We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone!
I have created an implementation that uses Processing.py which is running on an OpenShift server (X-server). However, I am getting the following error when I'm trying to use the save()/saveFrame() function(s):
Traceback (most recent call last):
File "/var/lib/openshift/558d45f179c053b43d000bbb/app-root/data/tempcode/0N2KD3.py", line 34, in setup
paint()
File "/var/lib/openshift/558d45f179c053b43d000bbb/app-root/data/tempcode/0N2KD3.py", line 78, in paint
paintloop()
File "/var/lib/openshift/558d45f179c053b43d000bbb/app-root/data/tempcode/0N2KD3.py", line 69, in paintloop
save(image_path)
java.lang.ClassCastException: [I cannot be cast to [B
at sun.awt.image.ByteInterleavedRaster.getDataElements(ByteInterleavedRaster.java:364)
at processing.core.PGraphicsJava2D.loadPixels(PGraphicsJava2D.java:2314)
at processing.core.PImage.save(PImage.java:3286)
at processing.core.PApplet.save(PApplet.java:4071)
at jycessing.DriverImpl$36.__call__(DriverImpl.java:559)
at org.python.core.PyObject.__call__(PyObject.java:403)
at org.python.core.PyObject.__call__(PyObject.java:407)
at org.python.pycode._pyx2.paintloop$4(/var/lib/openshift/558d45f179c053b43d000bbb/app-root/data/tempcode/0N2KD3.py:70)
at org.python.pycode._pyx2.call_function(/var/lib/openshift/558d45f179c053b43d000bbb/app-root/data/tempcode/0N2KD3.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:120)
at org.python.core.PyFunction.__call__(PyFunction.java:337)
at org.python.pycode._pyx2.paint$5(/var/lib/openshift/558d45f179c053b43d000bbb/app-root/data/tempcode/0N2KD3.py:75)
at org.python.pycode._pyx2.call_function(/var/lib/openshift/558d45f179c053b43d000bbb/app-root/data/tempcode/0N2KD3.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:120)
at org.python.core.PyFunction.__call__(PyFunction.java:337)
at org.python.pycode._pyx2.setup$3(/var/lib/openshift/558d45f179c053b43d000bbb/app-root/data/tempcode/0N2KD3.py:34)
at org.python.pycode._pyx2.call_function(/var/lib/openshift/558d45f179c053b43d000bbb/app-root/data/tempcode/0N2KD3.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:120)
at org.python.core.PyFunction.__call__(PyFunction.java:337)
at org.python.core.PyFunction.__call__(PyFunction.java:332)
at jycessing.PAppletJythonDriver.setup(PAppletJythonDriver.java:326)
at processing.core.PApplet.handleDraw(PApplet.java:2245)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243)
at processing.core.PApplet.run(PApplet.java:2141)
at java.lang.Thread.run(Thread.java:745)
java.lang.ClassCastException: java.lang.ClassCastException: [I cannot be cast to [B
When I'm running the code locally on my Ubuntu-machine, it works perfectly. Its just when I'm trying to deploy it that I'm getting this problem. I am running CentOS 64-bit, java 1.7.0_79, python 2.7.5.
Has anyone ran in to this problem before or has an idea of what could be wrong? I am running out of ideas.
Regards,
Johanna
Answers
At some point in the loadPixels method (or in a method called by loadPixels) an attempt was made to convert an integer array to a byte array.
loadPixels returns an integer array representing the pixel colour data, are you assigning it to a byte array? Unlikely since it is working on X-server mmmm...
Does Python have dynamic typing? Maybe that might be causing the problem.
OK so I don't have a solution but this might trigger some ideas.
EDIT made a mistake [B is a byte array. I have corrected this post
Hey, thanks for your comments, they did trigger some ideas and I think I have narrowed it down to the x server, something doesn't work properly while using it. I think I will leave it for a while and try some other approach and maybe revisit this later on. Thanks for your help!