I tried the code WakeMeAtThree posted with my own video file which I added in the data folder. In processing I get the error:
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(Unknown Source)
at jycessing.LibraryImporter.recursivelyAddJarsToClasspath(Unknown Source)
at jycessing.LibraryImporter.addLibrary(Unknown Source)
at jycessing.LibraryImporter$1.call(Unknown Source)
at org.python.core.PyObject.call(PyObject.java:480)
at org.python.core.PyObject.call(PyObject.java:484)
at org.python.pycode._pyx95.f$0(Test.pyde:1)
at org.python.pycode._pyx95.call_function(Test.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._pyx94.f$0(/var/folders/13/yzsw53f93c3dd8q0x_kw33c40000gn/T/Test12641138659274035512/Test.pyde:96)
at org.python.pycode._pyx94.call_function(/var/folders/13/yzsw53f93c3dd8q0x_kw33c40000gn/T/Test12641138659274035512/Test.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(Unknown Source)
at jycessing.PAppletJythonDriver.findSketchMethods(Unknown Source)
at jycessing.Runner.runSketchBlocking(Unknown Source)
at jycessing.mode.run.SketchRunner.lambda$startSketch$3(Unknown Source)
at java.base/java.lang.Thread.run(Thread.java:829)
When I run this script in the terminal I get the error:
Exception: This sketch requires the “video” library. at 0:0 in Test.pyde
Thanks for your answer! Yes I did and also downloaded the library and manually added it to a subdirectory named libraries in my projectfolder just in case (as stated in these docs: Processing.py on the command line \ Tutorials).
The Java version works just fine by the way, also tested that out.
I get a similar error as eefneef when trying to run the code from WakeMeAtThree even though I installed and added the library.
Also when I try to add libraries in other projects in python mode I get the same error:
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._pyx35.f$0(sketch_220213b.pyde:1)
at org.python.pycode._pyx35.call_function(sketch_220213b.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._pyx34.f$0(/Users/leonwoltermann/Documents/Processing/Projects/5/2/sketch_220213b/sketch_220213b.pyde:96)
at org.python.pycode._pyx34.call_function(/Users/leonwoltermann/Documents/Processing/Projects/5/2/sketch_220213b/sketch_220213b.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:829)
Python mode from the command line has not been actively maintained for some time now, unfortunately.
Have you tried to use the video library from the Processing IDE?
Processing 4.0 betas and Python mode are still a bit rough.
There are also some issues on loading Python mode libraries in different platforms (I had trouble with Serial and Video on Windows and Mac a few years ago)