I want to know a using method of bpy.data.fonts.remove() function.

I coding a such as below.

import bpy

print(bpy.data.fonts.keys()) # return : [‘ArialMT’, ‘ArialMT’, ‘ArialMT’, ‘Bfont’, ‘David’, ‘FranklinGothic-Medium’, ‘PalatinoLinotype-Roman’]


But appear a error message such as below.

TypeError: BlendDataFonts.remove(): error with keyword argu
Error: Python script fail, look in the console for now…

How to using function of bpy.data.fonts.remove().

Please answer to me.
Thank you.

You need to pass the font object not its name

font = bpy.data.fonts.get("David")

as for most remove methods in bpy.data collections, the font will need to have 0 users.

I have resolved this problem with your reply.
Thank you.