benfry / processing4

Processing 4.x releases for Java 17
https://processing.org
Other
1.35k stars 237 forks source link

Python sketches that are not in Examples fail to load in the IDE #793

Open Zishan-Rahman opened 1 year ago

Zishan-Rahman commented 1 year ago
## Description

Whenever I try to load a Processing sketch in Python, other than an example sketch via the "Examples" selection dialog, the IDE crashes and closes by itself. I tried opening the sketch via "Open Recent", "Open" and even the "Sketchbook" selection dialog, but still the sketch fails to load. Java mode does not have this issue.

Expected Behavior

The Python sketch should load without further issues, just as a Java sketch would (and does).

Current Behavior

When I try to load the sketch, I get this error:

Screenshot from 2023-10-08 14-10-49

Steps to Reproduce

  1. Install Python Mode for Processing 4 via Contribution Manager (version 4001)
  2. Load a sketch via the aforementioned methods (any method other than the "Examples" dialog). I usually load an example sketch, save it in a different folder (using "Save As", of course), then close the IDE and try to open the same sketch from its new location.
  3. Wait for the error message to show up.

Your Environment

Possible Causes / Solutions

Hopefully it's just a fixable bug in file handling somewhere. I don't know for sure yet, though.

borisalmonacid commented 10 months ago

same here OS Windows 11

reflect.InaccessibleObjectException: Unable to make private static native void java.awt.AWTEvent.initIDs() accessible: module java.desktop does not "opens java.awt" to unnamed module @256216b3 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) at org.python.core.PyJavaType.init(PyJavaType.java:298) at org.python.core.PyType.createType(PyType.java:1523) at org.python.core.PyType.addFromClass(PyType.java:1462) at org.python.core.PyType.fromClassSkippingInners(PyType.java:1585) at org.python.core.PyJavaType.init(PyJavaType.java:270) at org.python.core.PyType.createType(PyType.java:1523) at org.python.core.PyType.addFromClass(PyType.java:1462) at org.python.core.PyType.fromClassSkippingInners(PyType.java:1585) at org.python.core.PyJavaType.init(PyJavaType.java:270) at org.python.core.PyType.createType(PyType.java:1523) at org.python.core.PyType.addFromClass(PyType.java:1462) at org.python.core.PyType.fromClassSkippingInners(PyType.java:1585) at org.python.core.PyJavaType.init(PyJavaType.java:270) at org.python.core.PyType.createType(PyType.java:1523) at org.python.core.PyType.addFromClass(PyType.java:1462) at org.python.core.PyType.fromClass(PyType.java:1551) at org.python.core.adapter.ClassicPyObjectAdapter$6.adapt(ClassicPyObjectAdapter.java:77) at org.python.core.adapter.ExtensiblePyObjectAdapter.adapt(ExtensiblePyObjectAdapter.java:44) at org.python.core.adapter.ClassicPyObjectAdapter.adapt(ClassicPyObjectAdapter.java:131) at org.python.core.Py.java2py(Py.java:2017) at org.python.core.PyJavaPackage.addClass(PyJavaPackage.java:86) at org.python.core.PyJavaPackage.__findattr_ex__(PyJavaPackage.java:135) at org.python.core.PyObject.__findattr__(PyObject.java:965) at org.python.core.PyObject.__findattr__(PyObject.java:950) at org.python.core.imp.ensureFromList(imp.java:1016) at org.python.core.imp.ensureFromList(imp.java:990) at org.python.core.imp.import_module_level(imp.java:977) at org.python.core.imp.importName(imp.java:1057) at org.python.core.ImportFunction.__call__(__builtin__.java:1280) at org.python.core.PyObject.__call__(PyObject.java:450) at org.python.core.__builtin__.__import__(__builtin__.java:1232) at org.python.core.imp.importFromAs(imp.java:1149) at org.python.core.imp.importFrom(imp.java:1124) at org.python.pycode._pyx11.f$0(KeyCodes.pyde:17) at org.python.pycode._pyx11.call_function(KeyCodes.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._pyx10.f$0(C:/Users/b/Documents/Processing/modes/PythonMode/examples/Advanced/KeyCodes/KeyCodes.pyde:96) at org.python.pycode._pyx10.call_function(C:/Users/b/Documents/Processing/modes/PythonMode/examples/Advanced/KeyCodes/KeyCodes.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)

image