5

When I easy_install some python modules, warnings such as:

<some module>: module references __file__
<some module>: module references __path__
<some module>: module MAY be using inspect.trace
<some module>: module MAY be using inspect.getsourcefile

sometimes get emitted.

Where (what package / source file) do these messages come from? Why is referencing __file__ or __path__ considered a bad thing?

Matt Anderson
  • 19,311
  • 11
  • 41
  • 57

2 Answers2

7

easy_install doesn't like use of __file__ and __path__ not so much because they're dangerous, but because packages that use them almost always fail to run out of zipped eggs.

easy_install is warning because it'll install "less efficiently" into an unzipped directory instead of a zipped egg.

In practice, I'm usually glad when the zip_safe check fails, because then if I need to dive into the source of a module it's a ton easier.

sorin
  • 161,544
  • 178
  • 535
  • 806
durin42
  • 1,447
  • 8
  • 10
2

I wouldn't worry about it. As durin42 notes, this just means that setuptools won't zip the egg when it puts it into site packages. If you don't want to see these messages, I believe you can just use the -Z flag to easy_install. That will make it always unzip the egg.

I recommend using pip. It gives you a lot less unnecessary output to deal with.

Jason Baker
  • 192,085
  • 135
  • 376
  • 510
  • In-case anyone was wondering, this is correct about the `-Z` (`--always-unzip (-Z) don't install as a zipfile, no matter what`). – chown Dec 02 '11 at 21:42
  • Although -Z does mean always install unzipped, it will still spit out the warnings (at least it does for me). – Kenneth Hoste Mar 01 '13 at 13:38