Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20163
| Date | 2012-02-10 09:24 -0500 |
|---|---|
| From | Dave Angel <d@davea.name> |
| Subject | Re: changing sys.path |
| References | <mailman.5303.1328112912.27778.python-list@python.org> <d0253e03-fed0-40db-8a7a-e9195ce92889@k28g2000yqc.googlegroups.com> <4F3516CC.1070401@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5659.1328883901.27778.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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