En Sat, 29 Sep 2007 17:32:15 -0300, marvinla <ma************@gmail.com>
escribi�:
Have you tried a del?
>>import socket
dir()
['__builtins__', '__doc__', '__name__', 'socket']
>>del socket
dir()
['__builtins__', '__doc__', '__name__']
pyimport socket
pydel socket
pyimport sys
pysys.modules['socket']
<module 'socket' from 'c:\apps\Python25\lib\socket.pyc'>
del only removes the reference from the current namespace, but the module
is still loaded and available.
del sys.modules['socket'] would remove the module so the next import
statement will have to reload it.
Back to the original question, timeoutsocket replaces some objects in the
socket module with its own versions, just "unloading" timeoutsocket would
not be enough, the changes had to be reverted.
timeoutsocket is an old hack for Python 2.2 and earlier. Since 2.3 you can
achieve the same thing using socket.setdefaulttimeout() so unless you are
forced to use such ancient versions, it can be dropped.
--
Gabriel Genellina