# bpy.app.translations.register gets “ValueError” on “translations message cache”

def register():
bpy.utils.register_module(__name__)
bpy.app.translations.register(__name__, translate.translation_dict)


It throws back a ValueError:

translations message cache already contains some data for addon '__main__'


Googled around but can't find anything similar. Can't figure out what it meant and how to dealt with.

Something to do with cached data that can be deleted?

• If you are running this from the text editor then __name__ == "__main__" either install as an addon and reload the script or hardcode in your addon name to test. – batFINGER May 20 '18 at 14:31
• It works now. Then, do I hv to remove this line of code when i actually package this addon for others to use? or do i just leave it there? – adrian li May 21 '18 at 19:40
• @batFINGER I tried to reload with F8, but still not working. I am using text editor inside Blender, what else should i check? I am running the register() inside if __name__ == "__main__": – adrian li May 30 '18 at 18:46
• If the addon is registered as an addon (when you enable an addon it is imported from the addon folder "the_addons_name", then __name__ == "the_addons_name" and henceforth __name__ == "__main__"  is false. It's True when run from text editor. Have you tried calling bpy.app.translations.unregister("__main__") ? ... you really want to be loading as an addon and not running from text editor. – batFINGER May 30 '18 at 19:27