Re: peak/utils/addons import problem

PJ Eby <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]> Mon, 24 Oct 2011 16:09:17 -0400
Newsgroups gmane.comp.python.peak
Message-ID <CALeMXf6xumXCtBVnch8tsptZefW4dHZ5D6m=twt2ep6kG=k0Gg@mail.gmail.com>
--===============0524944281==
Content-Type: multipart/alternative; boundary=00248c0d78a8623a7c04b010ff73

--00248c0d78a8623a7c04b010ff73
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Oct 24, 2011 at 3:38 PM, nicky van foreest <[email protected]>wrote:

> Sorry for my misunderstanding. This is the output:
>
> nicky@chuck:~$ python
> Python 2.7.2+ (default, Oct  4 2011, 20:06:09)
> [GCC 4.6.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import peak.util.addons
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named addons
> >>> import peak.util
> >>> print peak.util.__path__
> ['/home/nicky/lib/python/Extremes-1.1.1-py2.7.egg/peak/util']
> >>> import pkg_resources
> >>> pkg_resources.require('AddOns')
> [AddOns 0.7 (/home/nicky/lib/python/AddOns-0.7-py2.7.egg),
> DecoratorTools 1.8
> (/home/nicky/lib/python/DecoratorTools-1.8-py2.7.egg)]
> >>> print peak.util.__path__
> ['/home/nicky/lib/python/Extremes-1.1.1-py2.7.egg/peak/util']
> >>> import peak.util.addons
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named addons
> >>>
>
> > My guess is that you now have a peak.util directory in your Ubuntu system
> > Python directory and it's not working properly with your current
> directory.
>
> I also checked whether my system contains any other peak.util
> directory than the one in ~/lib/python , but this is not the case.
>

Okay, try doing the same thing, but this time also do:

>>> pkg_resources.declare_namespace('peak.util')

Before the "require()" call, and see if peak.util.__path__ changes.

--00248c0d78a8623a7c04b010ff73
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div class=3D"gmail_quote">On Mon, Oct 24, 2011 at 3:38 PM, nicky van foree=
st <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]">vanforeest=
@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Sorry for my misunderstanding. This is the output:<br>
<br>
nicky@chuck:~$ python<br>
Python 2.7.2+ (default, Oct =A04 2011, 20:06:09)<br>
[GCC 4.6.1] on linux2<br>
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;=
license&quot; for more information.<br>
&gt;&gt;&gt; import peak.util.addons<br>
Traceback (most recent call last):<br>
 =A0File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>
ImportError: No module named addons<br>
&gt;&gt;&gt; import peak.util<br>
&gt;&gt;&gt; print peak.util.__path__<br>
[&#39;/home/nicky/lib/python/Extremes-1.1.1-py2.7.egg/peak/util&#39;]<br>
<div class=3D"im">&gt;&gt;&gt; import pkg_resources<br>
&gt;&gt;&gt; pkg_resources.require(&#39;AddOns&#39;)<br>
</div>[AddOns 0.7 (/home/nicky/lib/python/AddOns-0.7-py2.7.egg),<br>
DecoratorTools 1.8<br>
(/home/nicky/lib/python/DecoratorTools-1.8-py2.7.egg)]<br>
&gt;&gt;&gt; print peak.util.__path__<br>
[&#39;/home/nicky/lib/python/Extremes-1.1.1-py2.7.egg/peak/util&#39;]<br>
&gt;&gt;&gt; import peak.util.addons<br>
Traceback (most recent call last):<br>
 =A0File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>
ImportError: No module named addons<br>
<div class=3D"im">&gt;&gt;&gt;<br>
<br>
&gt; My guess is that you now have a peak.util directory in your Ubuntu sys=
tem<br>
&gt; Python directory and it&#39;s not working properly with your current d=
irectory.<br>
<br>
</div>I also checked whether my system contains any other peak.util<br>
directory than the one in ~/lib/python , but this is not the case.<br></blo=
ckquote><div><br></div><div>Okay, try doing the same thing, but this time a=
lso do:</div><div><br></div><div>&gt;&gt;&gt; pkg_resources.declare_namespa=
ce(&#39;peak.util&#39;)</div>
<div><br></div><div>Before the &quot;require()&quot; call, and see if peak.=
util.__path__ changes.</div><div><br></div><div><br></div></div>

--00248c0d78a8623a7c04b010ff73--

--===============0524944281==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
PEAK mailing list
[email protected]
http://www.eby-sarna.com/mailman/listinfo/peak
--===============0524944281==--