[Zope] Dynamic script loading

Jan Maška jan.maska@systinet.com
Wed, 9 Apr 2003 10:40:56 +0200


Hello Pawel,

This is quite a gotcha! :-)
Try:

import mymodule
#NOW IT'S LOADED
del ( mymodule )
#HERE IT SHOULD UNLOAD

Well, since loaded modules are nothing but objects, you can use the same
functions and calls as you use on standard objects in Python. What the
modules would return to standard operations, that's another story - but the
'del' should definitely work.


-Mac

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Pawel
Lewicki
Sent: Tuesday, April 08, 2003 6:56 PM
To: zope@zope.org
Subject: [Zope] Dynamic script loading


Hello,
I don't know if my question is more zopish or pythonish. I have a Zope
product. I had to add the specific functionality which is needed very
rarely. I would be glad to import external module only when it is needed, do
the job and free my mind and extra memory it consumed. How should I do that?
I have to admit that I don't find myself as an experienced Python
programmer. I just discover depths of this incredible language while
extending my Zope product.
Maybe anyone would help me with some relevant links.
Thanx in advance,

Pawel Lewicki




_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )