Error accessing custom properties? #86765

Closed
opened 2021-03-20 18:04:36 +01:00 by Will · 8 comments

System Information
Operating system: Linux
Graphics card: Intel

Blender Version
Broken: 2.92

Short description of error
rna_xml.rna2xml seems to try to access object custom properties as Python object attributes, which does not work.

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/usr/share/blender/2.92/scripts/modules/rna_xml.py", line 222, in rna2xml
    value = getattr(root_rna, attr)
AttributeError: 'Object' object has no attribute 'prop'

Exact steps for others to reproduce the error

  • Select the default cube
  • add a custom property to it ("prop")
  • Try accessing this "prop" or run:
import rna_xml; rna_xml.rna2xml(root_node="SomeName", root_rna=C.active_object)
**System Information** Operating system: Linux Graphics card: Intel **Blender Version** Broken: 2.92 **Short description of error** `rna_xml.rna2xml` seems to try to access object custom properties as Python object attributes, which does not work. ``` Traceback (most recent call last): File "<blender_console>", line 1, in <module> File "/usr/share/blender/2.92/scripts/modules/rna_xml.py", line 222, in rna2xml value = getattr(root_rna, attr) AttributeError: 'Object' object has no attribute 'prop' ``` **Exact steps for others to reproduce the error** - Select the default cube - add a custom property to it ("prop") - Try accessing this "prop" or run: ``` import rna_xml; rna_xml.rna2xml(root_node="SomeName", root_rna=C.active_object) ```
Author

Added subscriber: @WCN

Added subscriber: @WCN

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Interesting that 'prop' in dir(ob) returns True.
I don't think the problem is in the rna2xml module, but something involving custom properties.

Interesting that `'prop' in dir(ob)` returns `True`. I don't think the problem is in the `rna2xml` module, but something involving custom properties.
Germano Cavalcante changed title from `rna2xml` chokes on custom properties? to Error accessing custom properties? 2021-03-23 20:49:33 +01:00
Author

Ah, yeah. I guess there's two contradictory behaviours: Custom properties are usually item keys, but dir() seems to treat them like attributes? Which one is more correct, and does anything rely on the current behaviour of dir()?

I can't imagine that anything would rely on dir(), since dir() doesn't provide any way to differentiate custom properties from actual attributes, so anything using dir() would presumably just choke on attempted access in the same way that rna2xml does.

Ah, yeah. I guess there's two contradictory behaviours: Custom properties are usually item keys, but `dir()` seems to treat them like attributes? Which one is more correct, and does anything rely on the current behaviour of `dir()`? I can't imagine that anything would rely on `dir()`, since `dir()` doesn't provide any way to differentiate custom properties from actual attributes, so anything using `dir()` would presumably just choke on attempted access in the same way that `rna2xml` does.
Campbell Barton self-assigned this 2021-04-23 02:47:40 +02:00

This issue was referenced by 42089fcde0

This issue was referenced by 42089fcde087b3738312e52820a57504795c69f1

This issue was referenced by dc1e98d8a0

This issue was referenced by dc1e98d8a041e161a7bbda97cfac3df57d0ff320

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
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#86765
No description provided.