Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81418

Re: unloading a module created with imp.new_module

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'properly.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'python': 0.11; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:created': 0.16; 'unload': 0.16; 'wrote:': 0.18; 'module': 0.19; 'patrick': 0.19; 'header:User-Agent:1': 0.23; 'received:comcast.net': 0.24; 'references': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'is?': 0.30; 'returned': 0.30; 'subject:skip:i 10': 0.31; 'thanks!': 0.32; 'problem': 0.35; 'subject:with': 0.35; 'possible': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'deleting': 0.60; 'deleted?': 0.84; 'it\xe2\x80\x99s': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ned Batchelder <ned@nedbatchelder.com>
Subject Re: unloading a module created with imp.new_module
Date Sun, 23 Nov 2014 21:56:12 -0500
References <C093BC09-3AB7-49DB-B160-265A34C6BCDA@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host c-50-133-228-126.hsd1.ma.comcast.net
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <C093BC09-3AB7-49DB-B160-265A34C6BCDA@gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16218.1416797780.18130.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416797780 news.xs4all.nl 2937 [2001:888:2000:d::a6]:51691
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81418

Show key headers only | View raw


On 11/23/14 1:49 AM, Patrick Stinson wrote:
> If I create a module with imp.new_module(name), how can I unload it so that all the references contained in it are set to zero and the module is deleted? deleting the reference that is returned doesn’t seem to do the job, and it’s not in sys.modules, so where is the dangling reference?
>
> Thanks!
>

This sounds tricky, and possible very difficult to do properly.  Do you 
mind if I ask what the larger problem is?  Python might not be very good 
at having modules come and go as you want.

-- 
Ned Batchelder, http://nedbatchelder.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: unloading a module created with imp.new_module Ned Batchelder <ned@nedbatchelder.com> - 2014-11-23 21:56 -0500

csiph-web