Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Print console logs in terminal

    Cinema 4D SDK
    python r20
    2
    5
    2.0k
    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.
    • R
      Rage
      last edited by a_block

      Hi all,

      I'm developing an application that runs a python plugin in cinema4d from commandline. Here's the problem: I can't see the console prints. How do I make c4d to print the logs in the terminal console instead of its own (the internal one under script->console)?

      1 Reply Last reply Reply Quote 0
      • Y
        y_puech
        last edited by

        Hi,

        Are you using Cinema 4D release 20 commandline.app/exe? There's a known bug under investigation.
        The workaround is to use c4d.GePrint() instead of print().

        Note I moved the topic to Cinema 4D Development category.
        I also turned it into a Q&A. Please make use of this in the future. For more information see Q&A New Functionality.

        Former MAXON SDK Engineer

        1 Reply Last reply Reply Quote 2
        • Y
          y_puech
          last edited by y_puech

          Hi,

          There's a more convenient workaround than using GePrint().
          sys.__stdout__ original standard output stream can be used to redirect stdout and print to the terminal/console. Here's some code:

          # Stores the stdout redirected by Cinema 4D Python
          c4d_stdout = sys.stdout
          # Redirects to original stdout
          sys.stdout = sys.__stdout__
          
          # Prints something
          print("Some text to be printed to the terminal/console")
          
          # Restores Cinema 4D Python stdout redirection
          sys.stdout = c4d_stdout
          

          Former MAXON SDK Engineer

          R 1 Reply Last reply Reply Quote 4
          • R
            Rage @y_puech
            last edited by

            Thank you this works nicecly

            I'm using cinema 4D 20 student edition

            1 Reply Last reply Reply Quote 0
            • Y
              y_puech
              last edited by

              Hi,

              As I turned this discussion into a Q&A topic, if you're satisfied with my last post's solution then you can mark it as the correct answer or mark the topic as solved.
              For more information see Q&A New Functionality.

              Former MAXON SDK Engineer

              1 Reply Last reply Reply Quote 1
              • First post
                Last post