[python-win32] Shell extension debugging
Tim Roberts
timr at probo.com
Tue Jun 30 18:14:47 CEST 2009
Gertjan Klein wrote:
> Ah, but this is what confuses me. I don't have a DLL: I have a .py file,
> which gets interpreted by python. The DDLs that get loaded are
> python25.dll and two pywin32 dlls (don't remember offhand which). So,
> when the extension is first loaded, pywin32 must load python, compile
> the extension, and execute its methods. If it were possible to replace
> the compiled python code with a newer version this should work,
> shouldn't it? Because the dlls that Windows sees are still there.
>
It's not that easy. In Python, an object's method functions are just
another piece of data in the object. When a client instantiates your
COM object, the Python code creates an instance of your object,
including pointers to the intermediate language for the method
functions. That single object will live until the COM object is
released. Even if you were to use Python magic to reload the module
source, that would only affect new instances. All of the existing
instances will continue to point to the original intermediate language
code snippets.
> I haven't even though about using something like py2exe to compile the
> entire app into something distibutable yet, but it seems safe to assume
> that in that situation, replacing the code wouldn't work (but I don't
> mind that).
>
Well, remember that py2exe doesn't really "compile" the app. It just
bundles all of the source modules and DLLs together into a single unit.
When you run a py2exe app, it just unzips the contents to a temporary
directory and launches the interpreter as usual.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list