CollectionProperty declarations throwing errors randomly #61159

Closed
opened 2019-02-03 14:10:47 +01:00 by Dharma Teja Reddy Kasa · 10 comments

System Information
Operating system: Win 10
Graphics card: NVIDIA GTX 1060

Blender Version
Broken: 2.80, 2019-01-22

Short description of error
CollectionProperty randomly throwing registration error.

Exact steps for others to reproduce the error
Declarations are as follows:

class RenderLayersToInclude(bpy.types.PropertyGroup):
layerName: bpy.props.StringProperty()
isIncluded: bpy.props.BoolProperty()

class ConfigCreatorOperator(bpy.types.Operator):
....
layersToInclude : bpy.props.CollectionProperty(type=RenderLayersToInclude)
....

    def invoke(self, context):
          .....
          self.layersToInclude.clear()
          .....

Full error is as follows

TypeError: CollectionProperty(...): expected an RNA type, failed with: RuntimeError: , missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered)

GPUFrameBuffer: framebuffer status GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
Traceback (most recent call last):
File "E:\dmw\dmwTools\blenderScripts\modules\dmw\rqmanager\blender\configCreator.py", line 44, in invoke
self.layersToInclude.clear()
File "E:\dmw\software\blender\2.80-beta\2.80\scripts\modules\bpy_types.py", line 657, in getattribute
return super().getattribute(attr)
AttributeError: 'ConfigCreatorOperator' object has no attribute 'layersToInclude'

**System Information** Operating system: Win 10 Graphics card: NVIDIA GTX 1060 **Blender Version** Broken: 2.80, 2019-01-22 **Short description of error** CollectionProperty randomly throwing registration error. **Exact steps for others to reproduce the error** Declarations are as follows: > class RenderLayersToInclude(bpy.types.PropertyGroup): > layerName: bpy.props.StringProperty() > isIncluded: bpy.props.BoolProperty() > > class ConfigCreatorOperator(bpy.types.Operator): > .... > layersToInclude : bpy.props.CollectionProperty(type=RenderLayersToInclude) > .... > > def invoke(self, context): > ..... > self.layersToInclude.clear() > ..... > Full error is as follows > TypeError: CollectionProperty(...): expected an RNA type, failed with: RuntimeError: , missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered) > > GPUFrameBuffer: framebuffer status GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT > Traceback (most recent call last): > File "E:\dmw\dmwTools\blenderScripts\modules\dmw\rqmanager\blender\configCreator.py", line 44, in invoke > self.layersToInclude.clear() > File "E:\dmw\software\blender\2.80-beta\2.80\scripts\modules\bpy_types.py", line 657, in __getattribute__ > return super().__getattribute__(attr) > AttributeError: 'ConfigCreatorOperator' object has no attribute 'layersToInclude'

Added subscriber: @DharmaTejaReddyK

Added subscriber: @DharmaTejaReddyK
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Did you register RenderLayersToInclude before you registered ConfigCreatorOperator?

Did you register `RenderLayersToInclude` before you registered `ConfigCreatorOperator`?

Yes... I registered RenderLayersToInclude before ConfigCreatorOperator

Error is not consistant... It'll error out very randomly / unpredictable. There are no preferences or any initialization lines before registering.

Yes... I registered RenderLayersToInclude before ConfigCreatorOperator Error is not consistant... It'll error out very randomly / unpredictable. There are no preferences or any initialization lines before registering.

IMG_20190204_170651.jpg

Here is registration code (snapshot)

![IMG_20190204_170651.jpg](https://archive.blender.org/developer/F6505364/IMG_20190204_170651.jpg) Here is registration code (snapshot)
Member

Can you share a small complete example that we can use to reproduce the issue?

Can you share a small complete example that we can use to reproduce the issue?

BlenderBug_T61159.mp4
Find bug behavior in above video attachment. It errors out very randomly. No specific pattern.

Find source code below (video is recorded with following source code only)
BlenderBug_T61159.py

[BlenderBug_T61159.mp4](https://archive.blender.org/developer/F6517859/BlenderBug_T61159.mp4) Find bug behavior in above video attachment. It errors out very randomly. No specific pattern. Find source code below (video is recorded with following source code only) [BlenderBug_T61159.py](https://archive.blender.org/developer/F6517882/BlenderBug_T61159.py)
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Jacques Lucke self-assigned this 2019-02-05 16:36:28 +01:00
Member

I found two problems in the code.

  1. The dtrClasses object is a set instead of tuple or list. In Python sets have no ordering guarantees (yet?). That is probably the reason why the problem only appears sometimes.
  2. You call register_class in the unregister function.
I found two problems in the code. 1. The `dtrClasses` object is a `set` instead of `tuple` or `list`. In Python sets have no ordering guarantees (yet?). That is probably the reason why the problem only appears sometimes. 2. You call `register_class` in the `unregister` function.
  1. You're correct. I changed it to tuple and no there's no error after that. Thanks for correction. I didn't know ordering issue with sets. New learning today :)

  2. It's my bad. While trimming code base to provide example for you, I made that mistake.

We can close this ticket.

1. **You're correct**. I changed it to tuple and no there's no error after that. Thanks for correction. I didn't know ordering issue with sets. New learning today :) 2. It's my bad. While trimming code base to provide example for you, I made that mistake. We can close this ticket.
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#61159
No description provided.