Page MenuHome

When built as a Python module, Blender overwrites sys.exit() codes with its own exit code
Closed, ResolvedPublic

Description

System Information
Win 7 x64

Blender Version
Broken: git
Worked: unknown

Short description of error
When built as a Python module, Blender overwrites sys.exit() codes with its own exit code.

Exact steps for others to reproduce the error

  1. Import Blender as a Python module into an interactive Python console
  2. Execute sys.exit(1)
  3. Observe the exit code received by the OS, which will be 0

This bug can be worked around by calling os._exit() instead, which terminates the process immediately. That's hardly ideal though!

Event Timeline

Blender doesn't replace sys.exit, however we do register an atexit callback in which calls WM_exit_ext, but this isn't called when using python as a module.

so this may just be a regular bug rather then sys.exit specific, will check on it.

Thomas Dinges (dingto) lowered the priority of this task from 90 to Normal.Feb 12 2014, 2:32 PM
Campbell Barton (campbellbarton) changed the task status from Unknown Status to Resolved.Feb 12 2014, 8:58 PM

Closed by commit rBa397009181c8.