[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-distutils-sig
Subject:    [Distutils] Obtuse warning from pkg_resources when egg and non-egg
From:       Arve Knudsen <arve.knudsen () gmail ! com>
Date:       2010-12-15 16:49:56
Message-ID: AANLkTimpaGfPS_xrAuk-srsXxsNDt4CquY3uD7BbUtWr () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello

I've just been able to properly identify why pkg_resources at times issues
an obtuse (to me at least) warning along these lines: "Module <module> was
already imported from <filename>, but <egg> is being added to sys.path". It
turns out that really that a non-egg distribution is on the module search
path before a corresponding egg distribution. If you run bin/test.py in the
attached case, you should see a demonstration of the issue.

Right now, it bit me when testing under a continuous integration slave on a
machine where the tested project is also installed as an egg. I couldn't for
the life of me understand why this warning was being issued, when I couldn't
see it on my development machine. Not before painstakingly debugging
pkg_resources, did it dawn on me that pkg_resources only complained on the
test machine since there was no egg metadata in the source tree (whereas in
my development source tree there is). Until debugging pkg_resources I
actually didn't know that a directory (i.e., with Python packages) is
considered an egg if it has a .egg-info file (with egg metadata) in it. I
just hadn't had the motivation yet to learn the egg technology that well.

Considering that pkg_resources' rationale for issuing this warning is so
difficult to derive from the message, may I suggest please that we modify
the message somewhat for added clarity? If it were more explicit, it should
be much easier to rectify the warning's cause. My suggestion is a message on
this form: "'<egg>' is being added to sys.path, but contained module
'<module>' was already imported from '<filename>'. Could this be a non-egg
distribution?". From such a warning, it should be possible to derive that
the module may have been imported from what is not considered by
pkg_resources an egg distribution (such as a clean source tree).

Thanks,
Arve

[Attachment #5 (text/html)]

Hello<div><br></div><div>I&#39;ve just been able to properly identify why p=
kg_resources at times issues an obtuse (to me at least) warning along these=
 lines: &quot;Module &lt;module&gt; was already imported from &lt;filename&=
gt;, but &lt;egg&gt;=A0is being added to sys.path&quot;. It turns out that =
really that a non-egg distribution is on the module search path before a co=
rresponding egg distribution. If you run bin/test.py in the attached case, =
you should see a demonstration of the issue.</div>
<div><br></div><div>Right now, it bit me when testing under a continuous in=
tegration slave on a machine where the tested project is also installed as =
an egg. I couldn&#39;t for the life of me understand why this warning was b=
eing issued, when I couldn&#39;t see it on my development machine. Not befo=
re painstakingly debugging pkg_resources, did it dawn on me that pkg_resour=
ces only complained on the test machine since there was no egg metadata in =
the source tree (whereas in my development source tree there is). Until deb=
ugging pkg_resources I actually didn&#39;t know that a directory (i.e., wit=
h Python packages) is considered an egg if it has a .egg-info file (with eg=
g metadata) in it. I just hadn&#39;t had the motivation yet to learn the eg=
g technology that well.</div>
<div><br></div><div>Considering that pkg_resources&#39; rationale for issui=
ng this warning is so difficult to derive from the message, may I suggest p=
lease that we modify the message somewhat for added clarity? If it were mor=
e explicit, it should be much easier to rectify the warning&#39;s cause. My=
 suggestion is a message on this form: &quot;&#39;&lt;egg&gt;&#39; is being=
 added to sys.path, but contained module &#39;&lt;module&gt;&#39; was alrea=
dy imported from &#39;&lt;filename&gt;&#39;. Could this be a non-egg distri=
bution?&quot;. From such a warning, it should be possible to derive that th=
e module may have been imported from what is not considered by pkg_resource=
s an egg distribution (such as a clean source tree).</div>
<div><br></div><div>Thanks,</div><div>Arve</div>

--0015174a0e0e22db71049775baf4--
["test.zip" (application/zip)]

_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic