Python: overriden context prints out PyContext not found errors #37079

Closed
opened 2013-10-14 23:37:55 +02:00 by Dalai Felinto · 5 comments

%%%--- Blender version with error, and version that worked ---
Blender 2.60 to 2.69rc all fail and probably early versions as well.

- Steps for others to reproduce the error ---
  1. In the Python console write:
  2. override = {'selected_bases': list(bpy.context.scene.object_bases)}

[ caution, step (3) will remove all your scene objects ]
3) >>> bpy.ops.object.delete(override)

It seems to be working, but I get a lot of error prints such as:

PyContext 'window' not found
PyContext 'scene' not found
PyContext 'region' not found
PyContext 'area' not found
PyContext 'area' not found
PyContext 'screen' not found
PyContext 'screen' not found
PyContext 'active_object' not found
(...)

Those errors show in Debug and Release versions.
Reference documentation:
http://www.blender.org/documentation/blender_python_api_2_68_release/bpy.ops.html#overriding-context

Thanks%%%

%%%--- Blender version with error, and version that worked --- Blender 2.60 to 2.69rc all fail and probably early versions as well. - Steps for others to reproduce the error --- 1) In the Python console write: 2) >>> override = {'selected_bases': list(bpy.context.scene.object_bases)} [ **caution, step (3) will remove all your scene objects** ] 3) >>> bpy.ops.object.delete(override) It seems to be working, but I get a lot of error prints such as: PyContext 'window' not found PyContext 'scene' not found PyContext 'region' not found PyContext 'area' not found PyContext 'area' not found PyContext 'screen' not found PyContext 'screen' not found PyContext 'active_object' not found (...) Those errors show in Debug and Release versions. Reference documentation: http://www.blender.org/documentation/blender_python_api_2_68_release/bpy.ops.html#overriding-context Thanks%%%
Author
Owner

Changed status to: 'Open'

Changed status to: 'Open'
Author
Owner

%%%In a related note, I can segfault Blender very easily with this feature:

override = {'selected_bases': [bpy.context.object,]}
bpy.ops.object.delete(override)

I realize (now) that it crashes if I pass objects instead of object_bases (whatever the difference is ;).
This is pretty advanced so it's not the end of the world. It would be nice if we could not segfault though.%%%

%%%In a related note, I can segfault Blender very easily with this feature: >>> override = {'selected_bases': [bpy.context.object,]} >>> bpy.ops.object.delete(override) I realize (now) that it crashes if I pass objects instead of object_bases (whatever the difference is ;). This is pretty advanced so it's not the end of the world. It would be nice if we could not segfault though.%%%

%%%Hey Dalai, this is not a bug! You should feature those data in your fake pycontext as well!

Note best way if usually to do:
override = C.copy()
override['selected_bases'] = list(C.scene.object_bases)
bpy.ops.object.delete(override)

This just works fine…%%%

%%%Hey Dalai, this is not a bug! You should feature those data in your fake pycontext as well! Note best way if usually to do: override = C.copy() override['selected_bases'] = list(C.scene.object_bases) bpy.ops.object.delete(override) This just works fine…%%%

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Author
Owner

%%%I would say that at least the documentation is 'wrong', don't you agree?

[
and thanks for the instructions, I got what I wanted to do working ;)
https://github.com/dfelinto/addon-samples/blob/master/delete_family.py
]%%%

%%%I would say that at least the documentation is 'wrong', don't you agree? [ and thanks for the instructions, I got what I wanted to do working ;) https://github.com/dfelinto/addon-samples/blob/master/delete_family.py ]%%%
Sign in to join this conversation.
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-addons#37079
No description provided.