开发者

Where is the source code for a Python egg?

I'm attempting to add a video extension to the Python Markdown-2.0.3-py2.7.egg

Things aren't working, so I want to use pdb debugger to see what's going on.

I can't seem to find the source code to insert pdb.

The egg is located here:

/us开发者_运维百科r/local/lib/python2.7/site-packages/Markdown-2.0.3-py2.7.egg

Using iPython, I can view the Python source code of the Markdown module and it's path:

/usr/local/lib/python2.7/site-packages/Markdown-2.0.3-py2.7.egg/markdown/__init__.py

But I can't navigate to that file, nor can open it in a Text Editor.

I'm guessing the source code I'm viewing may be generated from the compiled egg. However, it seems there must be some way of accessing the code.


An .egg file is a simple ZIP archive, you can extract the files using any ZIP-enabled application if you want. That being said, you can install an .egg into a folder for development by passing the develop option to setup.py. This will make setuptools use the sources in the specified folder and just link to them by a file in your package path.


A .egg file is a zipfile -- so, typing at a command prompt or shell prompt unzip -l /usr/local/lib/python2.7/site-packages/Markdown-2.0.3-py2.7.egg should tell you about its contents, for example (if you have unzip on your shell or command's $PATH, of course).


You could reinstall the egg as a directory. Look in the comments of this answer

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜