c4dpy.exe and VS Code on Windows?

  • Hi,

    Has anyone had any luck getting R21's c4dpy.exe to work with the current release of VS Code? I've followed the installation instructions but I'm consistently prompted to "Select Python Interpreter", even though I've set "python.pythonPath": "C:/Program Files/Maxon Cinema 4D R21/c4dpy.exe" in the VS Code application and workspace settings.

    I've been able to get it running in PyCharm, but VS Code doesn't seem to recognize c4dpy.exe as a valid python interpreter.

    Any suggestions or insights would be greatly appreciated.


  • Hi Donovan, thanks for reporting. Which version of visual studio code you have? If its one of the latest (I don't know exactly which one, but it's seems it only support interpreter named python.exe as PyCharm does).
    I've open a bug report about it.

    But just in case maybe you have some previous configuration that prevents to work so could you try to do the next things:

    • Open Visual Studio Python Path settings
      • CTRL+SHIFT+P
      • Preferences: Open User Settings
      • Search for python.pythonPath
    • Reset the value in User / Workspace / Plugins
    • Restart Visual Studio Code
    • Open Visual Studio Python Path settings
      • CTRL+SHIFT+P
      • Preferences: Open User Settings
      • Search for python.pythonPath
    • Set the path of c4dpy (renamed to python.exe) in User or Workspace or Plugins according to your needs.
    • Restart Visual Studio Code
    • Wait until Python Extension Loading task is finished (this can take a few minutes and take a lot of CPU power since c4dpy will spawn a few c4dpy instances to inspect it).
    • Once it's done you can use c4dpy within Visual Studio as Previously.

    If you see the Python Extension Loading task taking forever (more than 10 minutes).

    • Kills Visual Studio Code.
    • Open c4dpy normally, see if licensing is ok. It may happen since it lunches several instances of c4dpy, that license gets corrupted (error 400).
      • If this happens apply what's recommended in c4dpy error 400 and execute again Visual Studio Code until the Python Extension Loading task finished (it needs to be done only once since visual studio code will use a cached version once its done)

    Let me know if it works.

  • @m_adam Thank you for the prompt and thorough reply. I believe I've followed your instructions exactly, but unfortunately: no luck.

    Screenshot of VS Code

    I even went so far as to completely remove all other Python installations and reinstall C4D via installer.

    It just doesn't seem to be recognizing C4D's embedded python as a valid python installation for some reason. I have confirmed that c4dpy.exe (renamed python.exe) has successfully logged in and is functioning as an interactive intepreter (and in PyCharm).

    Any other ideas?

    UPDATE: VS Code does seem to be invoking c4dpy, but I'm ~15min into this process with CPU usage pegged near 75% without visible progress:


  • Thanks for testing and reporting back.

    Could you switch python.jediEnabled. So if you Use Jedi autocompletion, to disable it or vise-versa.
    However, note that official answers from the vscode python module dev were that custom interpreters are for the moment not supported. (I know previously it was working...)

    And if you look at the visual studio community there are tons of bug reports about hight usage of CPU/RAM for the module loading for a big package.
    And I can continue.

    Unfortunately, since I'm on a holiday if switching the inspection tool by switching the value of jediEnabled doesn't help I can't help you more and we will need to dive into it when the team comes back in January.

    In the meantime, I hope you had a nice Christmas and I wish you a happy new year.

  • Hey, I run into the same issue on a Mac. I followed the instruction how to use c4dpy in VS Code but when I am pasting the path to c4dpy in the python interpreter settings, it does not accept it. No messages, nothing. I cannot select c4dpy as a python interpreter.



  • Hi, unfortunately, there is an issue, and my version was working because visual studio code used a cache of the interpreter.

    And from visual studio code, there is no official support for custom interpreters, so we will need to fix c4dpy to make it working correctly.


  • Thanks Maxime for clarifying. So we will wait for your fix :)

  • @m_adam could issue be highlighted in installation instructions for the next person who tries it? Would have saved me a few hours yesterday as I followed the documentation then spend a couple of hours trying to figure out what was going wrong.

  • @rossc1 Thanks for the inputs, I will for sure add a note in the documentation regarding this issue.

    Just as a follow-up from the current status, it is confirmed and while there is a behavior change in our side due to the new licensing mechanism, the issue also comes from Visual Studio Code, reading directly raw string to detect a valid interpreter, and fail if something is not formated as it wants. However, we received the official confirmation from Visual Studio Code that they will not change their implementation, and not support custom interpreters. But we are still on it.

    Regarding your needs for an IDE, you can use Pycharm, the only pre-requires is to rename c4dpy to python, unfortunately, we can't officially recommend doing such things since newer OS (Catalina) prevent user changing content of an application package but @dskeith explained everything cleary in How to use c4dpy for Cinema4D R20 SP1.