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

Closed
opened 2014-02-07 18:53:04 +01:00 by Tom Edwards · 9 comments

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

  • Import Blender as a Python module into an interactive Python console
  • Execute sys.exit(1)

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!

**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** - Import Blender as a Python module into an interactive Python console - Execute `sys.exit(1)` # 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!
Author

Changed status to: 'Open'

Changed status to: 'Open'
Campbell Barton was assigned by Tom Edwards 2014-02-07 18:53:04 +01:00
Author

Added subscriber: @artfunkel

Added subscriber: @artfunkel

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.

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.

Added subscriber: @ThomasDinges

Added subscriber: @ThomasDinges

This issue was referenced by blender/blender-addons-contrib@a397009181

This issue was referenced by blender/blender-addons-contrib@a397009181c8fa76501f09029d7f308e4961df51

This issue was referenced by blender/blender@a397009181

This issue was referenced by blender/blender@a397009181c8fa76501f09029d7f308e4961df51

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit blender/blender@a397009181.

Closed by commit blender/blender@a397009181.

Added subscriber: @Rkia

Added subscriber: @Rkia
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#38541
No description provided.