Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19729
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'run-time': 0.05; 'suppose': 0.05; 'imports': 0.07; 'paths': 0.07; 'subject:changing': 0.07; 'python': 0.08; 'am,': 0.12; 'cc:addr :python-list': 0.15; '9:15': 0.16; 'then?': 0.16; 'wrote:': 0.16; 'wed,': 0.17; 'cc:no real name:2**0': 0.21; "doesn't": 0.22; 'feb': 0.22; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.25; 'code': 0.25; 'modify': 0.25; 'pm,': 0.26; 'work,': 0.26; 'import': 0.27; 'looks': 0.27; 'importing': 0.28; 'cc:addr:python.org': 0.29; 'actually': 0.32; 'actual': 0.32; 'error.': 0.32; 'modules': 0.32; 'message-id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'there': 0.33; 'eric': 0.34; 'received:209.85.212': 0.34; 'running': 0.35; 'file': 0.35; 'two': 0.37; 'run': 0.37; 'list,': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'could': 0.37; 'some': 0.38; 'received:209.85': 0.38; 'same.': 0.38; 'received:209': 0.39; 'subject:: ': 0.39; 'your': 0.61; 'same,': 0.67; 'works,': 0.68; 'andrea': 0.84; 'snow': 0.91 |
| 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:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=c0/61VqJJXy7mZ9UWrnDJXNIUofb/BF6wqX0egHoU3g=; b=rZ4j+x3iYzDcHZHZaKt2MdOMsJ3MiWxWbIhjKlnXmHVFrR9Vv1dwlijswhksEYPgbC c6nTZAOqLHP8JB80j3lzoqn6ZaFY0MdWsxH9522QPjhQ4fh+mjISHB8KdOxin2d2HJSE YyxXt3lWuW/uA82MTu6REztOqLZ7zaqdEaLO8= |
| Date | Wed, 01 Feb 2012 17:47:22 +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 | Eric Snow <ericsnowcurrently@gmail.com> |
| Subject | Re: changing sys.path |
| References | <4F296509.60607@gmail.com> <CALFfu7D16_uCoFNVcU6CjErLYYaOQJosfH41Gsm=N47bWpJs5Q@mail.gmail.com> |
| In-Reply-To | <CALFfu7D16_uCoFNVcU6CjErLYYaOQJosfH41Gsm=N47bWpJs5Q@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Cc | python-list@python.org |
| 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.5313.1328118446.27778.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1328118446 news.xs4all.nl 6983 [2001:888:2000:d::a6]:39192 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19729 |
Show key headers only | View raw
On 02/01/2012 05:13 PM, Eric Snow wrote: > On Wed, Feb 1, 2012 at 9:15 AM, Andrea Crotti<andrea.crotti.0@gmail.com> wrote: >> 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. > Make sure you are adding to sys.path the directories that your > packages/modules are in, and not the actual package directories. > During import Python looks for modules/packages _in_ each of the > directories on sys.path, but not _at_ those directories. Yes sure I do this.. > >> 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. > You mean sys.path looks exactly the same in the two cases? > > -eric Yes they are exactly the same, because in that file I just write exactly the same list, but when modifying it at run-time it doesn't work, while if at the application start there is this file everything works correctly... That's what really puzzles me.. What could that be then?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: changing sys.path Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-01 17:47 +0000
Re: changing sys.path Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-02 00:51 +0000
Re: changing sys.path Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-02 10:03 +0000
Re: changing sys.path jmfauth <wxjmfauth@gmail.com> - 2012-02-02 05:45 -0800
csiph-web