title: Accessing files in python egg from inside the egg
body: <p>The question is an attempt to get the exact instruction on how to do that. There were few attempts before, which don't seem to be full solutions:</p>
  
  <p><a href="https://stackoverflow.com/questions/3071327/problem-accessing-config-files-within-a-python-egg">solution to move the file inside the package</a></p>
  
  <p><a href="https://stackoverflow.com/questions/3655352/how-to-access-files-inside-a-python-egg-file">solution to read as zip</a></p>
  
  <p><a href="https://stackoverflow.com/questions/177910/accessing-python-eggs-own-metadata">accessing meta info via get_distribution</a></p>
  
  <p>The task at hand is to read the information about the egg the program is running from.
  There are few ways as i understand:</p>
  
  <ol>
  <li><p>hard code the location of the egg and treat it as zip archive - will work, but not flexible enough, because it will need to be edited and recompiled in case if file is moved to another location</p></li>
  <li><p>use <code>ResourceManager().resource_filename(__name__, filename)</code> - this seems to be limited in the fact that i cannot access the file that is inside the egg, but not inside the package. notations like "../../EGG-INFO/PKG-INFO" in filename don't work giving KeyError. So no good either.</p></li>
  <li><p>use <code>dist = pkg_resources.get_distribution("dist_name")</code> and then use dist object to get information, but I cannot understand from the docs how should i specify my distribution name? It can't find it.</p></li>
  </ol>
  
  <p>So, i'm looking for correct solution about using <code>pkg_resources.get_distribution</code> plus it would be nice to finally have a full solution to read any file from inside the egg.</p>
  
  <p>Thanks!</p>