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

References <Xns9F4094E80B476OKB@88.198.244.100> <Xns9F40ABFFADCF6OKB@88.198.244.100>
Date 2011-08-14 01:07 +0100
Subject Re: Relative import from script with same name as package
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2258.1313280462.1164.python-list@python.org> (permalink)

Show all headers | 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