unload/delete modules

Jp Calderone exarkun at intarweb.us
Tue Feb 11 15:28:24 EST 2003


On Tue, Feb 11, 2003 at 06:47:20AM -0800, Sebastien de Menten wrote:
> Hi,
> 
> I have done some research on the topic but it is still very fuzzy...
> 
> I have the following script
> 
> for i in range(5):
> 	create_module_foo_with_function_run_that_print_i(i)
> 	import foo
> 	foo.run()
> 
> The function "create_module_foo_with_function_run_that_print_i(i)" :
>  - write a .pyx file (Pyrex file), with code for printing the argument
> i
>  - translate the file with Pyrex in c code
>  - compile the c code to get a foo.so module.
> 

  There is no platform-independant way to unload shared object libraries
(even doing it correctly on different releases of the same platform can be a
challenge), and so Python makes absolutely zero attempt to have reload()
work on .so modules.

> [snip]
> Is there a solution for my problem ?

  I'm not sure you've told us your problem ;)  You have told us one solution
you've selected to your problem, and the problems that *it* has, though.  So
I think I can say that there is no solution to this solution.  Maybe you can
tell us the real problem you're trying to address, and we can all try and
come up with a different solution.


   Jp

-- 
#!/bin/bash
( LIST=(~/.netscape/sigs/*.sig)
  cat ${LIST[$(($RANDOM % ${#LIST[*]}))]}
  echo --$'\n' `uptime` ) > ~/.netscape/.signature
-- 
 up 3 days, 0:28, 2 users, load average: 0.09, 0.08, 0.03
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030211/6a6a0ccd/attachment.sig>


More information about the Python-list mailing list