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


Groups > comp.lang.python > #19717

changing sys.path

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'run-time': 0.05; 'suppose': 0.05; 'imports': 0.07; 'paths': 0.07; 'subject:changing': 0.07; "doesn't": 0.22; 'code': 0.25; 'modify': 0.25; 'guess': 0.25; 'import': 0.27; 'depends': 0.28; 'importing': 0.28; "didn't": 0.30; 'actually': 0.32; 'error.': 0.32; 'modules': 0.32; 'received:209.85.214': 0.32; 'message-id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'to:addr:python-list': 0.33; 'there': 0.33; 'anything': 0.34; 'running': 0.35; 'something': 0.35; 'run': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'some': 0.38; 'received:209.85': 0.38; 'same.': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.40; 'works,': 0.68; 'order,': 0.73
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=iu9JAq1nzz5rjlx0zlxobqqBzTgf07+cjctvBod4ng0=; b=G0MTF+ZFQCZvByjkSrVTzxg8woeesPmgpcOMnlvTa+wnJ7lHH8O4D/AcFu6oPla/cY 0N5vn9Hq84ZAA9Lfi1R6Mjven3XRTxC4uYq35OX73peYQhKpLOaQFQHjiP2JGkjwls/+ GJYRS7Dao7GyE+Ba+NcS8cmPycIWMFD20ttC8=
Date Wed, 01 Feb 2012 16:15:05 +0000
From Andrea Crotti <andrea.crotti.0@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111224 Thunderbird/9.0.1
MIME-Version 1.0
To python-list@python.org
Subject changing sys.path
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
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.5303.1328112912.27778.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328112912 news.xs4all.nl 6883 [2001:888:2000:d::a6]:58283
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19717

Show key headers only | View raw


So suppose I want to modify the sys.path on the fly before running some code
which imports from one of the modules added.

at run time I do
sys.path.extend(paths_to_add)

but it still doesn't work and I get an import error.

If I take these paths and add them to site-packages/my_paths.pth
everything works, but at run-time the paths which I actually see before
importing are exactly the same.

So there is something I guess that depends on the order, but what can I
reset/reload to make these paths available (I thought I didn't need 
anything in theory)?

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


Thread

changing sys.path Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-01 16:15 +0000
  Re: changing sys.path jmfauth <wxjmfauth@gmail.com> - 2012-02-01 09:06 -0800
  Re: changing sys.path Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-01 09:17 -0800
    Re: changing sys.path Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-10 13:08 +0000
    Re: changing sys.path Dave Angel <d@davea.name> - 2012-02-10 09:24 -0500
    Re: changing sys.path Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-10 14:51 +0000
    Re: changing sys.path Dave Angel <d@davea.name> - 2012-02-10 10:06 -0500
    Re: changing sys.path Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-10 15:14 +0000
    Re: changing sys.path Peter Otten <__peter__@web.de> - 2012-02-10 16:27 +0100
    Re: changing sys.path Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-10 15:38 +0000
    Re: changing sys.path Peter Otten <__peter__@web.de> - 2012-02-10 16:40 +0100
    Re: changing sys.path Peter Otten <__peter__@web.de> - 2012-02-10 17:00 +0100
    Re: changing sys.path Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-10 20:58 +0000
  Re: changing sys.path Tim Roberts <timr@probo.com> - 2012-02-02 21:10 -0800
  Re: changing sys.path John Nagle <nagle@animats.com> - 2012-02-08 13:43 -0800

csiph-web