35 votes

How can I run blender from command line or a python script without opening a GUI?

All what Aldrik wrote, and more Blender Python API Tips and Tricks From official Blender documentation: For scripts that are not interactive it can end up being more efficient not to use Blenders ...
Ruslan L.'s user avatar
  • 511
30 votes
Accepted

How to use Keyframes and the Python API programmatically?

Figured it out! Here's how to use the Python API to set it: ...
Julian's user avatar
  • 561
29 votes
Accepted

How to get Blender's version number from Python?

bpy.app.version_string Test using the python console: >>> bpy.app.version_string '2.83.2' Usage within a script file: ...
Greg's user avatar
  • 583
22 votes

Install Addons in Headless Blender

Using python you can install an addon with bpy.ops.wm.addon_install(), you can then enable the addon with ...
sambler's user avatar
  • 55.1k
19 votes
Accepted

Rendering a cube as png file using Blender's Python API

Please invest time into researching about the Blender API and Python interface, before asking questions! ...
Leander's user avatar
  • 25.7k
18 votes

How to open system console to get output from Blender on Mac OS 10?

Right click on the Blender icon in the Applications folder and select "Show Package contents". Make an alias of Contents/MacOS/Blender by right clicking and ...
user007's user avatar
  • 526
15 votes
Accepted

Can you clear the System Console without restarting Blender?

Below is an example add-on that adds a button to the text editor for this purpose. Clearing the console is done with the platform specific commands cls for Windows ...
Robert Gützkow's user avatar
  • 25.4k
13 votes

Blender script run print to console

Override print method. Been investigating a number of ways to do this. Possibly the simplest is to override the print in your scripts. Below is designed to ...
batFINGER's user avatar
  • 83.5k
13 votes
Accepted

Rendering on command-line with GPU?

The following script allows you to enable all GPUs and optionally all CPUs as well. ...
Robert Gützkow's user avatar
  • 25.4k
12 votes

Can you clear the System Console without restarting Blender?

You can use os.system and call cls or clear: ...
HikariTW's user avatar
  • 7,771
11 votes

Is there anyway to make blender print errors in the UI?

If you do not want to restart Blender to see the messages sent to stdout or stderr, you can always run your script in blenders ...
Florian Franzen's user avatar
11 votes

How to pass command line arguments to a Blender Python script?

thanks for the suggestions. I just managed to get a working example following the double-dash idea that retains all of argparse's functionality with minimal ...
fr_andres's user avatar
  • 511
10 votes
Accepted

How to make Blender exit after running Python script from command line?

use bpy.ops.wm.quit_blender()?
Bruno's user avatar
  • 4,159
10 votes

How to render in command line?

Firstly open your Command Processor. Windows(Command Prompt) Linux(Terminal) Mac(Command Line). For Windows: In cmd first type ...
Yash's user avatar
  • 1,296
9 votes

I can't load an image from a script

To load an image from disk doesn't require bpy.ops. You could use: ...
zeffii's user avatar
  • 39.4k
8 votes

How can I run blender from command line or a python script without opening a GUI?

For 2.79b ...
Ajay Rajawat's user avatar
8 votes

Why doesn't the Blender console go away when opening the program?

Same here, since a few days – due to a Windows 11 update, I think. Anyway, to start Blender without the console, you can run blender-launcher.exe. It's in the same ...
Sietse Brouwer's user avatar
7 votes
Accepted

Install Addons in Headless Blender

You can just unzip the add-on into the /2.7x/scripts/addons/ directory. On Linux, it should be in the same directory as Blender. If there is more than just a single ...
Scott Milner's user avatar
  • 4,433
7 votes
Accepted

Command line script renders without shaders

You're not actually rendering the 'simple.blend' file. You're actually rendering the default blend file. This is because the order of command line arguments matters. To explain further, your ...
Ray Mairlot's user avatar
  • 29.1k
7 votes

Can you clear the System Console without restarting Blender?

As of 2021, there is an operator for this. Clear command history only: bpy.ops.console.clear(scrollback=False, history=True) Clear command history and ...
Michael's user avatar
  • 171
6 votes

What does "Invalid clnors in this fan!" mean?

Since I had the same message in the console with my processor going crazy, and I haven't found more information about that here, I answere this old question. In my case it was related to custom split ...
Mareck's user avatar
  • 1,944
6 votes

What does "Invalid clnors in this fan!" mean?

Clnors stands for Custom Loop Normals. This happens when clnors are not equal to each other where they should (would have to see the geometry), this message is printed and they are all replaced with ...
Jaroslav Jerryno Novotny's user avatar
6 votes
Accepted

Automatic select vertices by given coordinates

If the indices no longer correspond, you can: use a brute-force proximity check use spatial search structure (K-dimensional-Tree). Template for getting a bmesh in Object or Edit mode can be found ...
zeffii's user avatar
  • 39.4k
6 votes
Accepted

Change value of material emission strength from Python console or script

Found a solution: bpy.data.materials['material_name'].node_tree.nodes["Emission"].inputs[1].default_value = 3 #or any other value Thanks to this reference
nest's user avatar
  • 203
6 votes

How to open system console to get output from Blender on Mac OS 10?

The only way to see the Blender console and thus the script output is to launch Blender from a terminal using the full path to the executable: ...
Bruno's user avatar
  • 4,159
6 votes

Environment variables specific to Blender? Do they exist?

...
Valery S.'s user avatar
  • 306
6 votes
Accepted

Invalid drivers aren't shown and can't be deleted

Remove, since removed shape-key drivers. From pic in question appears they are shape key drivers, which remain if a keyblock is removed, renamed (To reproduce, add a shapekey "Key 1", give ...
batFINGER's user avatar
  • 83.5k
5 votes
Accepted

run a text block from command line

Unlike most command line programs the order of the options make a difference. The thing to remember is that blender executes each option in the order they are given, almost like a mini script. The ...
sambler's user avatar
  • 55.1k
5 votes

How can I run blender from command line or a python script without opening a GUI?

you can also directly run expressions without having to create a new .py file like this: ...
cak3_lover's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible