Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.037 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'imports': 0.07; 'subject:changing': 0.07; 'extension.': 0.09; 'namespace': 0.09; 'am,': 0.12; 'declaration': 0.16; 'strangely': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.18; 'thanks,': 0.19; 'cc:no real name:2**0': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'path,': 0.23; 'code': 0.26; 'cc:addr:gmail.com': 0.28; 'putting': 0.28; 'example': 0.29; 'problem': 0.29; 'print': 0.29; 'cc:addr:python.org': 0.29; 'thread': 0.32; 'list': 0.32; 'changing': 0.32; "won't": 0.33; 'header:User-Agent:1': 0.33; 'it?': 0.33; 'something': 0.35; 'cc:2**1': 0.36; 'issue': 0.37; 'but': 0.37; 'received:192': 0.38; 'think': 0.38; 'suggestions': 0.39; 'more': 0.61; 'saw': 0.66; 'was:': 0.67; 'header:Reply- To:1': 0.70; 'care': 0.71; 'reply-to:no real name:2**0': 0.72; 'andrea': 0.84; 'directories,': 0.84; '(every': 0.91 Date: Fri, 10 Feb 2012 09:24:50 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111109 Thunderbird/3.1.16 MIME-Version: 1.0 To: Andrea Crotti Subject: Re: changing sys.path References: <4F3516CC.1070401@gmail.com> In-Reply-To: <4F3516CC.1070401@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:0SoaxVhZDOcyjZCm2Wm75rreDVjoARD3NoI96gG6zXi 28x6Ih1oF9E6wYl8lKT0hlcKKnTsVM6BAuJPwN6/i1vQ/RPMUN PMFWgWbLmQd9yBDL2rZgS8t0tOm+Zbnb1B3Mdk+ikOov0kBh8d zuC4lg7hZT3oYWdRafIo7NCkwJp5fixsRWSr5P4QjrFSbFlHR+ +lz397vjMa862qXxWxA1fHxcx21zwMa7OFHrS6ZqYMAJ6XKK8L ja/yNPgH8tiIJZMT79rSF8Ipm9AXPXnjAyU5YTPKgXTm6FfxdW lYOBQ1WaeGJ4BMGeUYTLibGOW4TH3NvbknZmYHLo+N9cuagft8 NZIqhWNWkVEnNuSI9qUk= Cc: python-list@python.org, Rick Johnson X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: d@davea.name 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: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328883901 news.xs4all.nl 6845 [2001:888:2000:d::a6]:45460 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20163 On 02/10/2012 08:08 AM, Andrea Crotti wrote: > I think I finally located the issue with the sys.path extension. > > The problem is that I have many namespace directories, for example > > lib: > - sub1 > - sub2 > > lib: > - sub3 > - sub4 > > But to have everything working I had lib.sub3 in easy-install.pth. > Now if I try to add something else to the path it doesn't take care of > the namespace > declaration > (every __init__.py in the packages contains: > __import__('pkg_resources').declare_namespace(__name__)) > and just doesn't find the other submodules.. > > If I try to add manually lib.sub1, lib.sub2 changing the sys.path the > imports will only work for the first one. > > Strangely if I just create a dev_main.pth in site-packages containing > the same paths, everything works perfectly. > > Any suggestions now that the problem is more clear? > Thanks, > Andrea The only code I saw in this thread was: sys.path.extend(paths_to_add) Can you add a print of paths_to_add, and of sys.path after you execute it? If there's only one path, are you putting it in a list anyway? If not then it won't do what you expect. -- DaveA