SOLVED Print console logs in terminal

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)?

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.

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

Thank you this works nicecly

I'm using cinema 4D 20 student edition

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.