Processing.py-Bugs icon indicating copy to clipboard operation
Processing.py-Bugs copied to clipboard

Serial library exception with Processing.py

Open pasathos opened this issue 7 years ago • 5 comments

add_library('serial') SERIAL_DEVICE="COM15"

def setup(): global my_port

#Connect to serial device for dev in Serial.list(): if dev == SERIAL_DEVICE: my_port = Serial(this, dev, 115200) print("Connected to '{}'".format(SERIAL_DEVICE)) break else: msg = "Could not find serial port '{}'" raise Exception(msg.format(SERIAL_DEVICE))

Clear the serial buffer and consume first

line incase we missed the start of it

my_port.clear() my_port.readStringUntil(10)

#Setup window size(400, 400, P3D)

UnsatisfiedLinkError: jssc.SerialNativeInterface.getSerialPortNames()[Ljava/lang/String; at jssc.SerialNativeInterface.getSerialPortNames(Native Method) at jssc.SerialPortList.getWindowsPortNames(SerialPortList.java:309) at jssc.SerialPortList.getPortNames(SerialPortList.java:298) at jssc.SerialPortList.getPortNames(SerialPortList.java:182) at processing.serial.Serial.list(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:188) at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:206) at org.python.core.PyObject.call(PyObject.java:464) at org.python.core.PyObject.call(PyObject.java:468) at org.python.pycode._pyx81.setup$1(teste.pyde:13) at org.python.pycode._pyx81.call_function(teste.pyde) at org.python.core.PyTableCode.call(PyTableCode.java:171) at org.python.core.PyBaseCode.call(PyBaseCode.java:125) at org.python.core.PyFunction.call(PyFunction.java:403) at org.python.core.PyFunction.call(PyFunction.java:398) at jycessing.PAppletJythonDriver.setup(PAppletJythonDriver.java:1320) at processing.core.PApplet.handleDraw(PApplet.java:2404) at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1557) at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:313)

pasathos avatar Sep 27 '18 16:09 pasathos

I can confirm this is an issue on Linux. To reproduce I used the IDE example at Cotributed Libraries in Python>Arduino_Firmata>arduino_input

@macarena @berinhard can you please help me confirm it is broken on Windows and MacOS? [ This breaks my Pot+Arduino intro workshops :(( ]

Alexandre

UnsatisfiedLinkError: jssc.SerialNativeInterface.openPort(Ljava/lang/String;Z)
	at jssc.SerialNativeInterface.openPort(Native Method)
	at jssc.SerialPort.openPort(SerialPort.java:158)
	at processing.serial.Serial.<init>(Unknown Source) 
	at processing.serial.Serial.<init>(Unknown Source)
	at cc.arduino.Arduino.<init>(Arduino.java:159)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.python.core.PyReflectedConstructor.constructProxy(PyReflectedConstructor.java:211)
	at org.python.core.PyReflectedConstructor.__call__(PyReflectedConstructor.java:180)
	at org.python.core.PyObject.__call__(PyObject.java:438)
	at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
	at org.python.core.PyMethod.__call__(PyMethod.java:228)
	at org.python.core.PyMethod.__call__(PyMethod.java:223)
	at org.python.core.Deriveds.dispatch__init__(Deriveds.java:19)
	at org.python.core.PyObjectDerived.dispatch__init__(PyObjectDerived.java:1112)
	at org.python.core.PyType.type___call__(PyType.java:1822)
	at org.python.core.PyType.__call__(PyType.java:1805)
	at org.python.core.PyObject.__call__(PyObject.java:515)
	at org.python.core.PyObject.__call__(PyObject.java:519)
	at org.python.pycode._pyx11.setup$1(arduino_input.pyde:53)
	at org.python.pycode._pyx11.call_function(arduino_input.pyde)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:125)
	at org.python.core.PyFunction.__call__(PyFunction.java:403)
	at org.python.core.PyFunction.__call__(PyFunction.java:398)
	at jycessing.PAppletJythonDriver.setup(PAppletJythonDriver.java:1358)
	at processing.core.PApplet.handleDraw(PApplet.java:2425)
	at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1547)
	at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:313)

villares avatar Mar 02 '19 13:03 villares

I've spent a few hours on this, and can't figure out a fix for it yet. I just don't seem to be able to make the native libs available at runtime.

jdf avatar Mar 02 '19 14:03 jdf

Hi @jdf could we try to marshal some external help on this one?

villares avatar Jul 07 '19 13:07 villares

I'm open to any and all ideas.

jdf avatar Jul 07 '19 17:07 jdf

Hi @jdf, somehow this is working again! Hurray!

villares avatar Sep 13 '19 23:09 villares