reloading modules question

Darrell news at dorb.com
Sun Dec 10 13:03:42 EST 2000


I haven't made extensive use of reload, and want to hear how it goes for
you.
Although killing Python would clean up memory leaks and the like.
I assume IIS would restart it, maybe??

# Hacked from the win32 demos
import win32api, win32pdhutil, win32con#, sys

def killProcSelf():
    myPid= win32api.GetCurrentProcessId()
    handle = win32api.OpenProcess(win32con.PROCESS_TERMINATE, 0,myPid)
    win32api.TerminateProcess(handle,0)

if __name__ == '__main__':
    killProcSelf()
    raw_input("Failed to kill self")

"Syver Enstad" wrote:
> Is it safe to loop through sys.modules.items()
> reloading each module, as long as I catch the ImportError?
>






More information about the Python-list mailing list