Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.041 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'none:': 0.07; 'subject:file': 0.07; '24,': 0.16; 'for,': 0.16; 'wrote:': 0.18; 'module': 0.19; 'seems': 0.21; 'import': 0.22; 'planned': 0.24; 'equivalent': 0.26; 'header:In-Reply-To:1': 0.27; 'appear': 0.29; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work:': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'explains': 0.36; "didn't": 0.36; 'nov': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'it!': 0.67; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=kPPKrV4f+BhRXnUoBD5PXE9juTEmkJPJFBavxrBzm5Y=; b=ThTSPlrhfAZX1RzGiqm7/LdDEJDvcNNzZPXbH3fT7pdaogNRjarRqq7ydq1mo5Ayn6 71AGDS/33c8z3b1xDzpuWHHAp+CHAbzyhwH4Z0ONHuj8URP65uaQJB9/Pm/oZPanFXka 5T/lvhy2z3pqg9LXnYI42LQw2PuJ5XA+t/Fgx87yHxd7AQf5NMOoIZ2UIkzxJOFt57SM NLN6H4UI5rl5/l384MvB8sm+kHGkH9r+rL2Lp/LuC5G5j5PutLXDQv+hW3wllPe32fEt PnO+19GTfvM2f/BRQ9kfIXYkVXwqAdqPrrMNw359bDymSss7mayp8HyueWvBCFPa1XqB EZAg== X-Received: by 10.68.227.36 with SMTP id rx4mr2244552pbc.128.1385293060912; Sun, 24 Nov 2013 03:37:40 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Sun, 24 Nov 2013 04:37:00 -0700 Subject: Re: Importing by file name To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385293064 news.xs4all.nl 15890 [2001:888:2000:d::a6]:38628 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60362 On Sun, Nov 24, 2013 at 4:05 AM, Chris Angelico wrote: > Undocumented... that explains why I didn't know about it! But that > does appear to be what I'm looking for, so is there some equivalent > planned as a replacement? Hmm, playing around with importlib a bit, this seems to work: from importlib import find_loader loader = find_loader('spam', ['/path/to']) if loader is not None: module = loader.load_module() The path passed to find_loader is searched instead of sys.path.