Registering a class using D.texts[...].as_module().register() no longer works in 2.93.0 #89193

Closed
opened 2021-06-16 11:37:36 +02:00 by Marek Smoliński · 4 comments

Operating system: Windows
Broken:
2.93.0, 84da0518b806, 2021-06-02 11:21
2.93.1 RC, 573011217479, 2021-06-09 06:57
3.0 Alpha, 4891da8ae225, 2021-06-15 22:44
Worked:
2.83.16 (release.051567553d29-windows.amd64)

Reproducing the issue
Scripting > Templates > Python > Operator Mesh Add

>>> m = D.texts['operator_mesh_add.py'].as_module()
>>> m.register()

Traceback (most recent call last):
  File "E:\w10\Downloads\blender-2.93.1-candidate+blender-v293-release.573011217479-windows.amd64-release\blender-2.93.1-candidate+blender-v293-release.573011217479-windows.amd64-release\2.93\python\lib\typing.py", line 1408, in get_type_hints
    base_globals = sys.modules[base.__module__].__dict__
KeyError: 'operator_mesh_add'
>>> 

Despite the error it does add the operator to the searchable list under F3 - the operator doesn't work and ends with its own error:

Error: Python: Traceback (most recent call last):
  File "<string>", line 70, in execute
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\modules\bpy_types.py", line 720, in __getattribute__
    return super().__getattribute__(attr)
AttributeError: 'AddBox' object has no attribute 'width'

location: <unknown location>:-1
``
Operating system: Windows Broken: 2.93.0, 84da0518b806, 2021-06-02 11:21 2.93.1 RC, 573011217479, 2021-06-09 06:57 3.0 Alpha, 4891da8ae225, 2021-06-15 22:44 Worked: 2.83.16 (release.051567553d29-windows.amd64) **Reproducing the issue** Scripting > Templates > Python > Operator Mesh Add ``` >>> m = D.texts['operator_mesh_add.py'].as_module() >>> m.register() Traceback (most recent call last): File "E:\w10\Downloads\blender-2.93.1-candidate+blender-v293-release.573011217479-windows.amd64-release\blender-2.93.1-candidate+blender-v293-release.573011217479-windows.amd64-release\2.93\python\lib\typing.py", line 1408, in get_type_hints base_globals = sys.modules[base.__module__].__dict__ KeyError: 'operator_mesh_add' >>> ``` Despite the error it does add the operator to the searchable list under F3 - the operator doesn't work and ends with its own error: ``` Error: Python: Traceback (most recent call last): File "<string>", line 70, in execute File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\modules\bpy_types.py", line 720, in __getattribute__ return super().__getattribute__(attr) AttributeError: 'AddBox' object has no attribute 'width' location: <unknown location>:-1 ``

Added subscriber: @Etherlord

Added subscriber: @Etherlord
Member

Added subscriber: @OmarEmaraDev

Added subscriber: @OmarEmaraDev
Member

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

Changed status from 'Needs Triage' to: 'Archived'
Member

I can replicate that on 3.0, but it seems to be fixed in 3.1 already. So this is resolved.

I can replicate that on 3.0, but it seems to be fixed in 3.1 already. So this is resolved.
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#89193
No description provided.