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


Groups > comp.lang.python > #61580

Re: load_module for import entire package

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'class,': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'runtime': 0.09; 'tmp': 0.09; 'works.': 0.09; 'def': 0.12; 'changes': 0.15; '"from': 0.16; 'disc': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:entire': 0.16; 'subject:import': 0.16; 'wrote:': 0.18; 'module': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'replace': 0.24; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'properties': 0.29; 'dec': 0.30; 'code': 0.31; 'getting': 0.31; 'that.': 0.31; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'to:addr:python-list': 0.38; 'that,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'first': 0.61; 'information': 0.63; 'received:myvzw.com': 0.84; 'working,': 0.84; 'defeat': 0.91; '2013': 0.98
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dave Angel <davea@davea.name>
Subject Re: load_module for import entire package
Date Wed, 11 Dec 2013 10:05:35 -0500
References <cbf4a2a0-82d9-4f4f-9b1c-c6baa36b1aee@googlegroups.com> <cbf4a2a0-82d9-4f4f-9b1c-c6baa36b1aee@googlegroups.com>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host 142.sub-70-208-162.myvzw.com
In-Reply-To <cbf4a2a0-82d9-4f4f-9b1c-c6baa36b1aee@googlegroups.com>
User-Agent Groundhog Newsreader for Android
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.3901.1386774277.18130.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386774277 news.xs4all.nl 2951 [2001:888:2000:d::a6]:43136
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61580

Show key headers only | View raw


On Tue, 10 Dec 2013 23:28:31 -0800 (PST), Sergey <sh0375@gmail.com> 
wrote:
> def get_obj():
>   pkg = load_package_strict("tmp", basedir)
>   from tmp import main
>   return main.TTT()


> It is working, but if package code changes on disc at runtime and I 
call get_obj again, it returns instance of class, loaded for the 
first time previously. 

That's how import works.  Once something has been imported,  the 
module information is cached. There are three ways to defeat that, 
but they're all risky. 



> How to replace line "from tmp import main" by getting properties of 
pkg?

No clue what you mean by that.

-- 
DaveA

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


Thread

load_module for import entire package Sergey <sh0375@gmail.com> - 2013-12-10 23:28 -0800
  Re: load_module for import entire package Dave Angel <davea@davea.name> - 2013-12-11 10:05 -0500
  Re: load_module for import entire package alex23 <wuwei23@gmail.com> - 2013-12-12 16:58 +1000
    Re: load_module for import entire package Sergey <sh0375@gmail.com> - 2013-12-12 23:09 -0800

csiph-web