[python-win32] Shell extension debugging

Gertjan Klein gklein at xs4all.nl
Sat Jul 4 12:48:40 CEST 2009


Mark Hammond wrote:

>I haven't caught up with the rest of the thread yet, but in my 
>experience, the shell keeps objects alive for as shorter time as 
>possible.  So you may find a completely new instance is requested for 
>each context menu request (or for each different item selected, or 
>something), so arranging to 'reload' your implementation module may well 
>work.  I've even used the 'Python.Server' object to reload via Exec() calls.

Another quick test confirms that the following works:

    def __del__(self):
        try:
            print "Deleting", self.__module__, "module."
            del sys.modules[self.__module__]
        except Exception, e:
            print "Failed:"
            print e

Now every change I make to the module immediately gets picked up by the
shell extension. No more killing Explorer! Can you (or anyone) see any
problems with this?

Gertjan.




More information about the python-win32 mailing list