5
$\begingroup$

I have the problem that Blender does not exit after executing in background mode from command line.

For example this command:

./blender -b -P test.py

gives me this output, but does not exit Blender:

Read prefs: /home/mbc/.config/blender/2.79/config/userpref.blend
found bundled python: /usr/local/blender/blender-2.79-linux-glibc219-x86_64/2.79/python
Hello world

My Python test script is very simple:

import bpy
print("Hello world")

Even if I don't run a Python script but just render a single frame, the Blender process does not exit.

I am running blender-2.79-linux-glibc219-x86_64 on Ubuntu 16.04.3 LTS with linux image version 4.4.0-112-lowlatency.

$\endgroup$

3 Answers 3

9
$\begingroup$

use bpy.ops.wm.quit_blender()?

$\endgroup$
1
  • $\begingroup$ Thanks! I could not find that in the API documentation myself. However, as I wrote in my answer below, Blender does quit by itself when I work around the audio-related hang problem. $\endgroup$
    – Mikkel
    Jan 31, 2018 at 14:32
0
$\begingroup$

Apparently there was something wrong with my audio setup in Linux. I run JACK via QJackCtl.

If I run Blender from the command line with the -noaudio switch, it exits on completion like it is supposed to.

$\endgroup$
0
$\begingroup$

This is the case on my Windows10 as well. If I run the following script:

import bpy
bpy.ops.wm.quit_blender()

using the command:

blender --noaudio --python myscript.py

it will exit without prompting with the "Do you really want to quit?" prompt. If I omit the --noaudio option it always prompts. I might suggest that we consider adding an optional force parameter to quit_blender()

$\endgroup$
1
  • $\begingroup$ If I add the -b option on the command line then it doesn't prompt. Of course, it also doesn't display the window. So prompting seems to be connected to both GUI and presence of audio. $\endgroup$
    – IRayTrace
    Jan 10, 2019 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.