Processing.py sound library causing Java errors?

Setup: Windows 10 / Processing 4.0.1 / Python Mode for Processing 4 4001 / Sound 2.3.1

I’ve been trying unsuccessfully to use the Sound library in Python mode.
This sketch just tries to load the sound library and call setup and draw:

add_library("sound")

def setup():
    print('setup')

def draw():
    print('draw')

Trying to run this gives me much Java unhappiness (see below). Any suggestions?
Thanks!
–amb

java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
	at jycessing.LibraryImporter.addJarToClassLoader(LibraryImporter.java:315)
	at jycessing.LibraryImporter.recursivelyAddJarsToClasspath(LibraryImporter.java:164)
	at jycessing.LibraryImporter.addLibrary(LibraryImporter.java:140)
	at jycessing.LibraryImporter$1.__call__(LibraryImporter.java:82)
	at org.python.core.PyObject.__call__(PyObject.java:480)
	at org.python.core.PyObject.__call__(PyObject.java:484)
	at org.python.pycode._pyx17.f$0(soundTest.pyde:6)
	at org.python.pycode._pyx17.call_function(soundTest.pyde)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1614)
	at org.python.core.Py.exec(Py.java:1658)
	at org.python.pycode._pyx16.f$0(C:/Users/ambro/Documents/Processing/soundTest/soundTest.pyde:96)
	at org.python.pycode._pyx16.call_function(C:/Users/ambro/Documents/Processing/soundTest/soundTest.pyde)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1614)
	at org.python.core.Py.exec(Py.java:1658)
	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276)
	at jycessing.PAppletJythonDriver.processSketch(PAppletJythonDriver.java:233)
	at jycessing.PAppletJythonDriver.findSketchMethods(PAppletJythonDriver.java:613)
	at jycessing.Runner.runSketchBlocking(Runner.java:399)
	at jycessing.mode.run.SketchRunner.lambda$2(SketchRunner.java:112)
	at java.base/java.lang.Thread.run(Thread.java:833)

1 Like

Welcome, @amb – have you tried Processing 3.5.4 instead?

2 Likes

Thanks @tabreturn that fixed it!
Using Processing 3.5.4 / Python Mode for Processing 3 3063 / Sound 2.3.1 works!

1 Like