Blender crashes when calling ArgumentParser.parse_args() if sys.argv is anything other than ["path/to/blender.exe"] #109435
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#109435
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 980 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.18
Blender Version
Broken: version: 3.5.1, branch: blender-v3.5-release, commit date: 2023-04-24 18:11, hash:
e1ccd9d4a1d3
Worked: (newest version of Blender that worked as expected)
Short description of error
Blender crashes when calling
ArgumentParser.parse_args()
ifsys.argv
is anything other than["path/to/blender.exe"]
I discovered this bug while trying to run a script using the
exec()
function. Any script that uses argparse makes blender crash.Exact steps for others to reproduce the error
You can run this code
Huh I can crash it from text editor but not from python console in blender. Interesting.
if ran in python console
args
would just beNamespace()
I noticed some python events can shutdown blender. In console the error is caucht (but notice that executing it twice with arrow up causes sytax error. What?). So we probably have 2 bugs here.
Executing
exit(123)
in text editor in shutsdown blender with error code 123. That is actually pretty funny :)The behaviour that you see is python library
argparse
"raising" an error by calling exit(2).I will try to fix it, but it will take ma long-ish time.
Calls to sys.exit will exit Blender, this isn't a crash but as this report shows, it can seem like a crash.
The
argparse
module is part of Python, in general if Python's own modules call sys.exit() this is not something Blender prevents.If you want to override this you can sub-class
argparse.ArgumentParser
and an alternative exit method (see its documentation).So I wouldn't consider this a bug.
The issue you mentioned with the Python console showing a stack trace then a syntax error for further input is a bug since the input from the previous command isn't cleared. Fixed:
489408e8d3
.