Obtuse warning from pkg_resources when egg and non-egg distributions clash
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
participants (1)
-
Arve Knudsen