[python-win32] import and asp-python and iis - strange behaviour

Mark Hammond mhammond at skippinet.com.au
Tue Jun 7 07:25:44 CEST 2005


[Steve]

> IIRC I did some experiments that showed me that under suitable
> circumstances the Python interpreter will see an updated
> module after an
> ASP page performs a reload() of the required module.

Yes, that is my experience too.  Python's reload sementics WRT existing
class instances from a reloaded module often catches people off-guard
though.

eg:

import foo

ob = foo.Klass()

# make a change to the class in module foo
reload(foo)
# 'ob' is still an instance of the *old* class - it does not see new class
changes.

But all these things should bite in exactly the same way in ASP and in
normal Python.  ASP may also call your script multiple times in multiple
threads, which you may also need to take into consideration when doing these
things (Python will never crash in this case, but the behaviour may not be
quite as expected)

Mark



More information about the Python-win32 mailing list