Blender Python Not Showing print() Output: How to Fix It

This post summarizes how to fix the issue: print() doesn't display any output in Blender Python.

Introduction

When you use the print() function in Blender Python, you might not see any output.

Here's how to fix that.

# Working version
Blender 4.2.0

Note: This article was translated from my original post.

Blender Python: How to See print Output

Open the System Console (Windows only)

If you're using Blender on Windows, you can view the print output by opening the System Console.

From the top tab in Blender, go to:

Window > Toggle System Console

This only works on Windows. If you're on macOS or Linux, this method won't work.

Launch Blender from the Command Line

While Windows users can open the console via the UI, macOS and Linux users need to start Blender from the command line to see print output.

- macOS:

On macOS, launch Blender from the terminal using the following commands:

cd /Applications/Blender.app/Contents/MacOS
./Blender

Once Blender is launched this way, any output from the print function in a Blender Python script will appear in the terminal.

Blender launched from the terminal with 'Hello, world' output from the print function

- Linux:

On Linux, you can achieve the same result by running the Blender binary directly from the terminal:

cd <blender installation directory>
./blender

Use Alternatives to print

If you prefer another method, you can use the Blender Python API to write output to a new text block instead.

import bpy

text_block = bpy.data.texts.new("PrintResult")

text_block.write("Hello, world!\n")
text_block.write("Hello, world!!\n")

Running this code creates a new text block named "PrintResult" and writes strings into it.

Text written to a new text block

Conclusion

We’ve summarized several ways to deal with the issue of print output not showing up in Blender Python.

It’s pretty cool how you can control Blender using its Python API even though it’s primarily a 3D tool.

Hope this helps someone out there!

[Related Article]

en.bioerrorlog.work

References