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


Groups > comp.lang.python > #11358

Re: Relative import from script with same name as package

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.053
X-Spam-Evidence '*H*': 0.89; '*S*': 0.00; 'am,': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:import': 0.16; 'subject:package': 0.16; 'wrote:': 0.16; 'header:In-Reply-To:1': 0.22; 'aug': 0.24; 'message- id:@mail.gmail.com': 0.29; 'subject:same': 0.30; 'sun,': 0.30; 'to:addr:python-list': 0.33; 'instead': 0.33; '(not': 0.38; 'received:google.com': 0.38; 'move': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'subject:with': 0.39; 'to:addr:python.org': 0.39; 'or,': 0.40; 'subject:from': 0.40; 'subject:name': 0.67
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=wYhQMPTQHQZCdIr46mD+JXiGWM+BJ8/qsc63EY/5l+E=; b=BrQb0SdrNDoGj/CvxtYZLj3yXDC44HouwW3bsRJLfpGLddxa8wC9dcD5kUx5wvobje JYNgS5yrCJYKftWaqyA0GL9yOKUOfumOfuvXl/nIxILKIBG5JjZYBHx35FsmB7d5qAhZ Cl+yOPf9zFjettIFZDiqbnh1YM2jckqFbzyhA=
MIME-Version 1.0
In-Reply-To <Xns9F40ABFFADCF6OKB@88.198.244.100>
References <Xns9F4094E80B476OKB@88.198.244.100> <Xns9F40ABFFADCF6OKB@88.198.244.100>
Date Sun, 14 Aug 2011 01:07:40 +0100
Subject Re: Relative import from script with same name as package
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2258.1313280462.1164.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1313280462 news.xs4all.nl 23944 [2001:888:2000:d::a6]:45007
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:11358

Show key headers only | View raw


On Sun, Aug 14, 2011 at 12:55 AM, OKB (not okblacke)
<brenNOSPAMbarn@nobrenspambarn.net> wrote:
> sys.path = sys.path[1:] + ['']
>
> (That is, move the current directory to the end of the search path
> instead of the beginning.)
>

Or, equivalently:

sys.path.append(sys.path.pop(0))

ChrisA

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


Thread

Relative import from script with same name as package "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-08-13 21:39 +0000
  Re: Relative import from script with same name as package "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-08-13 23:55 +0000
    Re: Relative import from script with same name as package Chris Angelico <rosuav@gmail.com> - 2011-08-14 01:07 +0100
  Re: Relative import from script with same name as package Oktay Şafak <oktaysafak@superonline.com> - 2011-08-14 12:57 +0300
    Re: Relative import from script with same name as package "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-08-14 18:48 +0000
      Re: Relative import from script with same name as package Oktay Şafak <oktaysafak@superonline.com> - 2011-08-15 01:56 +0300

csiph-web