Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Debugging in VS Code does not pause at breakpoints

    Scheduled Pinned Locked Moved Bugs
    2026pythonmacos
    2 Posts 2 Posters 47 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • idealflawI Offline
      idealflaw
      last edited by

      Dear community,
      I'm trying to setup VS Code as outlined in the Documentation here.

      I have the Cinema 4D Connector extension installed, and the script is successfully executed when i click on Debug in Cinema 4D, but it seems like my breakpoints are disregarded.

      I then added the launch.json with the code from the Documentation link above to my workspace, but the behavior is the same.

      Please see the video for clarification:

      Reproduction

      To recreate please follow these steps:

      1. In Cinema 4D:
        • Open the Script Manager.
        • Save a simple script (see below for the exact script I used)
        • Start Code Exchanger
      2. Open the scripts folder in VS Code:
        • Connect Cinema 4D Connector to the running C4D instance
      3. Back in Cinema 4D:
        • Click Send to IDE in the Script Manager
      4. Back in VS Code:
        • In the now open script, set two breakpoints (line 9 and 10)
        • Click Debug in Cinema 4D

      EXPECTED: I would like the script to break first in line 9 and then in line 10 to be able to inspect the values of greeting and target in the Run and Debug panel.
      ACTUAL: The script runs completely and I don't see any information on the state of the mentioned variables. I get a notification saying:

      We noticed you are attaching to ptvsd (Python debugger), which was deprecated on May 1st, 2020. Use debugpy instead.

      1. Still in VS Code:
        • Disconnect the debugger.
        • Go to the Run and Debug panel
        • Create a launch.json file
        • Replace the contents of the launch.json file with the code from the Documentation and save the file.
        • Go back to the saved script and try running Debug in Cinema 4D again.

      RESULT: Same as after step 4.

      System

      I'm on macOS Tahoe (Version 26.2)
      Cinema 4D 2026.1.2 (Build 2026_1_2_e960bfd939c3_2264416005) OSX
      Visual Studio Code Version: 1.108.2 (Universal)
      Cinema 4D Connector Version 1.2.2

      Test Code

      import c4d
      
      doc: c4d.documents.BaseDocument  # The currently active document.
      op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.
      
      def main() -> None:
          """Called by Cinema 4D when the script is being executed.
          """
          greeting = 'Hello'
          target = 'Cinema4D'
      
          print(f'{greeting}, {target}!')
      
      
      if __name__ == '__main__':
          main()
      

      I'm really sorry if i overlooked anything obvious, or am missing the point altogether. Either way, any help/pointers in the right direction would be greatly appreciated.
      Thank you all very much in advance for your time and consideration.
      Best,
      Julius

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF Offline
        ferdinand @idealflaw
        last edited by ferdinand

        Hey @idealflaw,

        Welcome to the Maxon developers forum and its community, it is great to have you with us!

        Getting Started

        Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.

        • Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
        • Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
        • Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.

        It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: How to Ask Questions.

        About your First Question

        Thank you for reaching out to us and please excuse the delay. But for now I can only confirm the issue, as I have no found a quick fix for this. Oddly enough, on my machine it does not work, but on the machine of a colleague it does. My hunch would be that either something (firewall) is interfering with the debugger server communication or VS Code mixes something up with the vanilla CPython environment. But that cannot really be, because then the code should not run due to missing dependencies. I also tried making the launch environment explicit but that did not do anything either (no surprise again because it does find the C4D python environment with an explicit launch.json, otherwise the code would not run at all).

        This problem only exists on MacOS, Windows is not affected. I have moved this topic into bugs and I cannot give an ETA when we will fix this.

        Sorry for the trouble,
        Ferdinand

        Reproduction Steps

        1. Attach to VS Code to Cinema 4D 2026.1 on MacOS.
        2. Run the script attached below and that a breakpoint on line 10.
        3. Run the script with the debugger attached.

        Result

        1. The debug environment will open and the debugger will attach.
        2. The code will neither halt on the manual stop set one line 10, nor on the raised exception. It will just run as if it would be running without a debugger.

        OK Windows 2026.1
        NOK MacOS 2026.1

        import c4d
        
        def main() -> None:
            """Called by Cinema 4D when the script is being executed.
            """
            a: int = 42
            b: float = 3.14
            c: float = a + b
            
            if c > 45:
                raise ValueError("c is too large!")
            else:
                print(f"c is {c}.")
        
        
        if __name__ == '__main__':
            main()
        

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • ferdinandF ferdinand moved this topic from Cinema 4D SDK
        • First post
          Last post