Unimport module

Chmouel Boudjnah chmouel at chmouel.com
Mon Mar 14 04:36:26 CET 2005


Hi,

I have some code like that to do kind of plugins load :

dir = listdir('/path/')
for i in dir:
	sys.path.append('/path/' + i "/")
	import Module
	doStuff()
	sys.path.remove('/path/' + i "/")

it's obviously not working since it get only the first import Module 
while the others doent get replaced, the only solution for me was too :

sys.modules.pop('Module')

which after it does works fine. But my question is what's happenning in 
the internals, does it free the memory of Module to do a sys.modules.pop ?

Cheers, Chmouel.

PS: Please Mail-Copy-To: i am not subscribed to the list




More information about the Python-list mailing list