Dynamically reloading extension modules
Ken Seehof
kens at sightreader.com
Wed Mar 21 18:57:01 EST 2001
> On Wed, Mar 21, 2001 at 03:36:15PM -0800, Ken Seehof wrote:
> > Not exactly. I didn't state the problem very clearly. The
> > problem is that while an extension module is loaded, the
> > module file (pyd on windows) is read-only.
> >
> > At least this is true on windows. On unix, I think maybe you
> > can rename the module file, rebuild it, and do a reload(module).
> > Is this true? Windows doesn't allow you to rename or rewrite
> > a dll while it is in use, so something like FreeLibrary would be
> > necessary.
>
> Sorry, I can't answer Windows questions. I haven't had to run
> Windows in years.
>
> But I would still think that reload() should work as long as
> you are using python modules, *not* c/c++ modules.
I -am- talking about c/c++ modules (which I have been referring
to as "extension" modules). Hence there's a bit more to it than
reload().
I want to recompile and reload a c/c++ extension module from
within a continuously running python program.
> Beazley has no disclaimers about reload working only on
> specific platforms.
>
> There is a caveat, objects created with the old module won't be
> updated.
More information about the Python-list
mailing list