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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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)?