Python Generator use a script
-
I have some python generators which all use a script in the {C4D_SCRIPTS_DIR} folder. But somehow with updating this morning, this doesn't work any more. The File that is used is PyHuisStand and I use the following rule to import this:
import PyHuisStand as HS
What do I do wrong?
Regards
Kris -
Hi @kverhaar I think you confuse the two environment variable
C4D_SCRIPTS_DIR
andC4DPYTHONPATH3XX
.C4D_SCRIPTS_DIR
is used by the script manager to know which script can be loaded in the script manager (in its dropdown)
C4DPYTHONPATH3XX
is used to extend the sys.path of python, so you can import others scripts in your script via with the usual python commandimport {FileName}
The last environment variable
C4DPYTHONPATH3XX
is always bound to the python version shipped with Cinema 4D to ensure compatibility. With that said in the latest updated as said in the Python SDK Documentation - What is New we updated Python from 3.9.1 to 3.10.8. Therefor the environment variable used by Cinema 4D 2023.2 is not anymoreC4DPYTHONPATH39
butC4DPYTHONPATH310
.So long story short, updating the environment variable name to
C4DPYTHONPATH310
should fix your issue.
Cheers,
Maxime. -
Thanks