Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
It took me a while to figure out which part caused the problem converting a scripting tag from py2 to py3... The console printed the following errors (multiple times at a time):
TypeError: Expected PyCapsule, not None The above exception was the direct cause of the following exception: SystemError: PyEval_EvalFrameEx returned a result with an error set
The problem was the message function (I think..). Did a simple test with a pyTag containing only 1 userData button and the following script:
import c4d def main(): pass def message(id, data): if id == c4d.MSG_DESCRIPTION_COMMAND: id2 = data['id'][0].id if id2 == c4d.ID_USERDATA: userDataId = data['id'][1].id if userDataId == 1: tst() def tst(): print ("tst")
_Copying an object with the pyTag - no problem. _Yes, the button just prints “tst” in python2 & 3 :} _Dragging in python2 - no problem. _Dragging the pyTag to another object (or a duplicate onto itself) in R23 - gives 2 errors
How can I solve this? I guess it's not the wisest idea in the world to put a SystemError in a try-except block... Tia, Jochem
I saw the following code in the “python3_migration” in the SDK mentioning the "PyCapsule", but It doesn’t make much sense to me :{
PyCObject_AsVoidPtr is replaced by PyCapsule_GetPointer _next code is only compatible in Python 2.7 P1MSG_UN = msg.GetVoid(c4d.BFM_CORE_PAR1) pythonapi.PyCObject_AsVoidPtr.restype = c_int pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object] P1MSG_EN = pythonapi.PyCObject_AsVoidPtr(P1MSG_UN)
_next code is only compatible in 3.7 P1MSG_UN = msg.GetVoid(c4d.BFM_CORE_PAR1) P1MSG_EN = pythonapi.PyCapsule_GetPointer(P1MSG_UN, None)
Hi, as a workaround you could add the next code in your message function.
import ctypes def message(id, data): if id == c4d.MSG_DRAGANDDROP: ctypes.pythonapi.PyCapsule_New.restype = ctypes.py_object capsule = ctypes.pythonapi.PyCapsule_New(b"", b"data", None) data["data"] = capsule
Note, this issue may not only affect the Python Tag but any Python BaseList2D which can interact with MSG_DRAGANDDROP, so even your Python TagData could cause the issue.
MSG_DRAGANDDROP
Keep in mind this is an internal bug, which will be fixed in a future update of Cinema 4D. Cheers, Maxime.
Hi @jochemdk, this is an internal bug, nothing you can fix, unfortunately, note that you can ignore them normally the Tag should work as expected.
I've opened a bug report about it.
Cheers, Maxime.
Have a same issue. There is a workaround to avoid Error messages?
Thx for your replies! I'll test it soon & hopefully the bug will be fixed
Hi,
without further feedback, we will consider this thread as solved by Wednesday and flag it accordingly.
Cheers, Ferdinand
@zipit Yes, thx - the system works :}
Hi @jochemdk,
okay, I then took the liberty to close the question You can of course still post here.