# Blender 2.93 - AttributeError: Operator has no attribute ‘X’

I had an animation export script that was working well in Blender 2.7, but I copied it over to my other computer that’s using Blender 2.9 and it’s not working anymore.

It seems that Blender cannot find the string corresponding to the desired path for the exported file. The script always breaks when I try to open the file path, saying: AttributeError: ‘EXPORT_OT_ss_animation has no attribute ‘filepath’.

I’ve looked through several tutorials, but they’re all using the same approach that I’m using (as well as appear to be written for past Blender versions), so I don’t know what’s going wrong. I did learn that I needed to switch to TOPBAR_MT_file_export from INFO_MT_file_export, but that didn’t fix this new problem.

Here’s the relevant code:

import bpy

class AnimationOperator(bpy.types.Operator):
bl_idname = “export.ss_animation”
bl_label = “Export SS Animation”

filepath = bpy.props.StringProperty(subtype=“FILE_PATH”)

def execute(self, context):
exportAnimation(self, context)
return {‘FINISHED’}

def invoke(self, context, event):
return {‘RUNNING_MODAL’}

def exportAnimation(self, context):
#I claim that what comes before attempting to open the file is irrelevant because none of it references self, but I’ll add it if users disagree with me.

file = open(self.filepath, ‘w’) #Breaks here; states AttributeError: ‘EXPORT_OT_ss_animation has no attribute ‘filepath’

#More code follows, but it’s irrelevant because it breaks before getting there

self.layout.operator_context = ‘INVOKE_DEFAULT’
self.layout.operator(AnimationOperator.bl_idname, text=“Animation Exporter”

def register():
bpy.utils.register_class(AnimationOperator)

def unregister():
bpy.utils.unregister_class(AnimationOperator)

if __name__ == ‘__main__’:
register()

• Just replace filepath = bpy.props... by filepath : bpy.props... . As of 2.93 you have to use annotations. Remove support for non-annotation properties in classes... from: wiki.blender.org/wiki/Reference/Release_Notes/2.93/Python_API Jun 20 at 6:23
• Ah, that did it! Thanks! Now to fix the cascade of remaining errors... >.< Jun 20 at 6:26

As of Blender 2.93 you have to use annotations. Support is dropped for 'non-annotation' properties.

Remove support for non-annotation properties in classes as this was only enabled while porting scripts to 2.8x API (afa5da9ce0)

Means in practice, just replace the assignment operator = for your properties by a colon :

filepath = bpy.props.StringProperty() # OLD
filepath: bpy.props.StringProperty()  # NEW