[python-win32] Shell extension debugging

Mark Hammond skippy.hammond at gmail.com
Sat Jul 4 08:20:47 CEST 2009


On 30/06/2009 5:09 AM, Tim Roberts wrote:
> Gertjan Klein wrote:
>> It doesn't over here, but another poster has shown me how to circumvent
>> this. If this is the only way to do that I will; there is no way to tell
>> PyWin32 to reload the extension? (I know reloading in Python is tough,
>> I'm expecting a "no" here. ;-))
>>
>
> I was going to respond "no" immediately, but now you've got me
> thinking.  Explorer loads the DLL, instantiates the COM object, and
> keeps it loaded forever.  I think that fact alone makes it impossible;
> even if you added a backdoor to reload the module, you still have an
> object in memory using the original implementation.

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.

Cheers,

Mark


More information about the python-win32 mailing list