Solved Issue with Python MultiProcessing in 24

Hi,

There seems t be a conflict between Python multiprocessing and Cinema 4D S24.

If I enter into the console:

import multiprocessing
MYVAR = multiprocessing.Array("c", 2000)

then a new instance of Cinema 4D is launched.

This means that if I have the above line in a plugin, new instances of Cinema 4D are launched recursively.

This behavior is not present in Cinema 4D versions before S24. Perhaps it's a Python3.9 issue.

C4D Release S24
Operating System Apple MacOS > OS X 11
Operating System Version # 11.4

Looking forward to your thoughts..

Hi @conductor, welcome in plugincafe :)

Unfortually I don't see a way to fix that. Cinema 4D is the Python Interpreter, and multiprocessing is designed to execute several instance of the current Python interpreter.

Maya and Blender have the exact same behavior than Cinema 4D.

You can somehow do it by overriding sys.executable and __file__ as explained here, but you will not be able to use any Cinema 4D API call within this MP.
Moreover it may break some other functionality so I would recommend restoring them as their default value at the end of the execution of your MP thing :)

Hope it helps,
Cheers,
Maxime.

Hi @conductor, welcome in plugincafe :)

Unfortually I don't see a way to fix that. Cinema 4D is the Python Interpreter, and multiprocessing is designed to execute several instance of the current Python interpreter.

Maya and Blender have the exact same behavior than Cinema 4D.

You can somehow do it by overriding sys.executable and __file__ as explained here, but you will not be able to use any Cinema 4D API call within this MP.
Moreover it may break some other functionality so I would recommend restoring them as their default value at the end of the execution of your MP thing :)

Hope it helps,
Cheers,
Maxime.

Hello @conductor,

without further questions or replies, we will consider this topic as solved by Monday, the 30th and flag it accordingly.

Thank you for your understanding,
Ferdinand

MAXON SDK Specialist
developers.maxon.net