Skip to content

Update __annotation__ in settings.py#32

Open
mothersup wants to merge 1 commit intoh4lfheart:blenderfrom
mothersup:blender
Open

Update __annotation__ in settings.py#32
mothersup wants to merge 1 commit intoh4lfheart:blenderfrom
mothersup:blender

Conversation

@mothersup
Copy link
Copy Markdown

In Python 3.14, which Blender 5.0.1 uses, annotations had been reworked such that __annotations__ is not directly accessible. This is used in op/settings.py, and causes the following error when used in Blender 5.0.1:

Python: Traceback (most recent call last):
File "..../io_scene_ueformat/op/import_helpers.py", line 27, in execute
options = self.options_class.from_settings(context.scene.uf_settings)
File "..../io_scene_ueformat/options.py", line 21, in from_settings
k: v for k, v in settings.get_props().items()
~~~~~~~~~~~~~~~~~~^^
File "..../io_scene_ueformat/op/settings.py", line 23, in get_props
for key in self.__annotations__.keys():
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'UFSettings' object has no attribute '__annotations__'. Did you mean: '__annotate_func__'?

My fix is to use annotationlib.get_annotations instead of __annotations__.

Use `annotationlib.get_annotations` instead of `__annotations__` which had been deprecated in Python 3.14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant