Problem with bpy.ops.object.material_slot_assign () when running a script from the console #70714

Closed
opened 2019-10-10 21:37:31 +02:00 by AlexN · 7 comments

System Information
Operating system: Linux-5.2.18-129.current-x86_64-with-glibc2.9 64 Bits
Graphics card: GeForce GTX 660/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.50

Blender Version
Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: f6cb5f5449
Worked: (optional)

Short description of error
For automation I created a script from a sequence of actions which works great if I run it in the blender console window, or if i Run Script in a text editor.
But when I run this script through the command line without the graphical shell of the blender - he crashed.
If I exclude bpy.ops.object.material_slot_assign (), the script succeeds, except that the materials are not used.
Problem is repeated regardless of the platform, Windows or Linux, regardless of the PC used (3 different PCs).

Exact steps for others to reproduce the error
./blender -b -P /home/convert/script.txt

The error is reproduced even in the simplest example

import bpy
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='SELECT')
bpy.context.object.active_material_index = 0
bpy.ops.object.material_slot_assign()

In a full script, everything is executed until it reaches the line bpy.ops.object.material_slot_assign ()
Without this line, the script completes successfully and the result is saved.
7.txt
And it does not depend on the assigned material.
I also attach an automatically generated file when the blender falls:
blender.crash.txt

**System Information** Operating system: Linux-5.2.18-129.current-x86_64-with-glibc2.9 64 Bits Graphics card: GeForce GTX 660/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.50 **Blender Version** Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: `f6cb5f5449` Worked: (optional) **Short description of error** For automation I created a script from a sequence of actions which works great if I run it in the blender console window, or if i Run Script in a text editor. But when I run this script through the command line without the graphical shell of the blender - he crashed. If I exclude bpy.ops.object.material_slot_assign (), the script succeeds, except that the materials are not used. Problem is repeated regardless of the platform, Windows or Linux, regardless of the PC used (3 different PCs). **Exact steps for others to reproduce the error** ./blender -b -P /home/convert/script.txt The error is reproduced even in the simplest example ``` import bpy bpy.ops.object.editmode_toggle() bpy.ops.mesh.select_all(action='SELECT') bpy.context.object.active_material_index = 0 bpy.ops.object.material_slot_assign() ``` In a full script, everything is executed until it reaches the line bpy.ops.object.material_slot_assign () Without this line, the script completes successfully and the result is saved. [7.txt](https://archive.blender.org/developer/F7803061/7.txt) And it does not depend on the assigned material. I also attach an automatically generated file when the blender falls: [blender.crash.txt](https://archive.blender.org/developer/F7803083/blender.crash.txt)
Author

Added subscriber: @Alex_N

Added subscriber: @Alex_N

Added subscriber: @mont29

Added subscriber: @mont29
Bastien Montagne self-assigned this 2019-10-11 11:57:40 +02:00

That operator is not designed to work without UI at all, it expects a valid 3DView from the context.

Will tweak the poll function of those ops to properly abort when this is not available, instead of crashing…

That operator is not designed to work without UI at all, it expects a valid 3DView from the context. Will tweak the poll function of those ops to properly abort when this is not available, instead of crashing…

Hrmmm, actually it’s a bit more involved, not sure why we need view3d here, still digging.

Hrmmm, actually it’s a bit more involved, not sure why we need view3d here, still digging.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Grmlll, broken auto-close with fixes in release branch it'd seem… Fixed by 1c2a20c84d.

Grmlll, broken auto-close with fixes in release branch it'd seem… Fixed by 1c2a20c84d.
Author

Thank you guys, you are the best and thank you for making the best program.

Thank you guys, you are the best and thank you for making the best program.
Sign in to join this conversation.
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
2 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#70714
No description provided.