How to access files inside a Python egg file?

The less command on *nix systems can peek inside zip files. Therefore less some.egg will list the contents of a .egg file too.


egg files are zipfiles, so you must access "stuff" inside them with the zipfile module of the Python standard libraries, not with the built-in open function!


If you want to access the contents inside the .egg file you can simply rename it and change extension from .egg to .zip and than unzip it. Which will create a folder and the contents will be same as they were when it was a .egg file

for example brewer2mpl-1.4.1-py3.6.egg
After Renaming brewer2mpl-1.4.1-py3.6.zip

Now if we open it, it'll get easily unzipped and the content will be put in a folder with same name in the same directory. (tested on macOS Sierra)

Tags:

Python

Egg