Unknown Operator errors with addon but not when run as script?

When I paste the following code into my console and run it:


bl_info = {  
 "name": "Test Addon: Unknown Op Errors",  
 "category": "System"}  

import bpy


addon_keymaps = []

def register():  
    wm = bpy.context.window_manager
    
    #Rediculous hotkey for duplicating and moving  
    km = wm.keyconfigs.addon.keymaps.new('Object Mode', space_type='EMPTY')
    kmi = km.keymap_items.new("object.duplicate_move", 'D','PRESS', alt=True,ctrl=True,
    shift=True)
    
    #Append keymap
    addon_keymaps.append(km)
     
      
def unregister():    
    #Unregister keymaps
    wm = bpy.context.window_manager
    for km in addon_keymaps:
        wm.keyconfigs.addon.keymaps.remove(km)
    del addon_keymaps[:]
        
if __name__ == "__main__":
    register()

The console reports no errors. And when I uncheck the addon for unregistering also, I get no errors. However when I save the addon in the User Preferences and then restart Blender I get this error in the console:


search for unknown operator 'OBJECT_OT_duplicate_move', 'OBJECT_OT_duplicate_move'

This is happening with several other predefined Blender operators that I am creating custom hotkeys for but not for a large variety of others. Could anyone possibly run this code, save the addon, restart Blender and report if you’re getting the same error? Just trying to figure out if this is something going on with my machine or Blender itself. Using 2.72b by the way, Windows 7 64 Bit. Obviously, not to big of a deal. The keys still function properly but I really don’t like starting Blender up with a cluttered Console screen. The original addon uses other custom classes and I use the module convention to take care of those, so I thought it might perhaps have something to do with how classes were being registered, but even in this most bare-bones stripped version, the same errors are happening. Thanks.

See https://blenderartists.org/forum/showthread.php?349932-ERROR-search-for-unknown-operator

That thread is of a similar context, but it’s not the same issue.

Yardie’s errors occur when loading the script. Mine do not occur at all when running or unregistering just if they are loaded as an addon when Blender starts up. There aren’t any classes or reference to modules in this code example.

All I’m doing is appending an already established Blender operator with a different hotkey and yet for some reason errors display if you install the addon, save your user preferences, and start up Blender again. Not sure why this is happening for a handful of the hotkeys that are in my actual script and not the others. But the operator included in this example is definitely one that reports this error after relaunching Blender. Either that, or it’s just something screwy on my Computer but I can’t be sure unless someone else checks it out. Thanks.

Hi SicutUnum,

I had the same problem with an other add-on and I have the solution now:
Use Notepad and go Search in folder-> locate your user pref add-ons folder and choose to search in this folder and take “duplicate_move” as target and run.
You must find the add-on with this key…
If you find nothing, change the target…“duplicate.move” may be etc…

Me I have find the add-on that create the conflict!

Me I have find the add-on that create the conflict!
The raison is that some add-ons haven’t a clear unregister() function and keep register some key after the addon is desactivated.

Thanks for the advice Spirou4D. In my situation, I know which addons are causing the issue because they are the ones I’m creating. I actually need the specific operation performed by object.duplicate_move which is a standard Blender operator. Interestingly enough “object.duplicate” (another standard Blender operator) does not cause this error to occur.

(once again, the error only shows up when you save the addon in the user prefs and then restart Blender).

Like I said, it seems to be a handful (or two or three) of operators causing this error. I’m still not sure if this is only on my computer though. Wish someone would test it out and let me know, but then again I guess this issue really more likely should be reported to the bug tracker.