34 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 ...
user avatar
  • 501
26 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: ...
user avatar
  • 533
25 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: ...
user avatar
  • 491
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! ...
user avatar
  • 24.8k
17 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 ...
user avatar
  • 53.8k
16 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 ...
user avatar
  • 486
13 votes
Accepted

Rendering on command-line with GPU?

The following script allows you to enable all GPUs and optionally all CPUs as well. ...
user avatar
13 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 ...
user avatar
12 votes

How to view the system console message after Blender crashes?

On windows just run blender from Command Prompt: Win Key+R In field type cmd and hit OK. Inside the console navigate to your blender.exe with command ...
user avatar
10 votes

Can you clear the System Console without restarting Blender?

You can use os.system and call cls or clear: ...
user avatar
  • 7,448
9 votes
Accepted

Access blender interactive python shell from terminal

The solution is to start blender with --python-console, see the user manual for Python command line args.
user avatar
9 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 ...
user avatar
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: ...
user avatar
  • 38.3k
9 votes
Accepted

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

use bpy.ops.wm.quit_blender()?
user avatar
  • 3,971
8 votes
Accepted

Silent command line rendering

You can redirect stdout to nul: blender --background --python hello.py 1> nul In the ...
user avatar
  • 18.9k
8 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 ...
user avatar
  • 78.7k
8 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 ...
user avatar
  • 1,266
7 votes
Accepted

How do I get the console on windows?

You go to Window>Console to open it:
user avatar
7 votes

How to view the system console message after Blender crashes?

Start blender from a console / cmd prompt in the first place and if it crashes, it will just return to the console and not close the console. For windows i set up a bat file to load cmd.exe, with any ...
user avatar
  • 38.3k
7 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 ...
user avatar
  • 441
7 votes

Calling Python Function from Console

If you name your script *.py in the text editor you can import it in the console as a module. Beware - after you imported the script for the first time you can't ...
user avatar
  • 9,490
7 votes

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

For 2.79b ...
user avatar
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 ...
user avatar
  • 28.2k
6 votes
Accepted

How can I run blender from the command line to export and import models

Apart from the info that this question already gives you, you need to figure out the operators to call from the Python script. Enable Python Tooltips (User Preferences -> Interface -> Display), then ...
user avatar
  • 6,771
6 votes

Batch generate preview/thumbnail image for old files?

Thumbnail extraction via Python The most current thumbnailer is maintained by ideasman42: https://github.com/dfelinto/blender-git/blob/master/release/bin/blender-thumbnailer.py It extracts ...
user avatar
  • 37.7k
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 ...
user avatar
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 ...
user avatar
  • 1,934
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 ...
user avatar
  • 38.3k
6 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 ...
user avatar
  • 4,303

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