epydoc executes python file

267 Views Asked by At

i have a python file with several classes in it and wanted to use epydoc to create a documentation from my comments. So i do on console on my Debian wheezy system:

epydoc --html storage_config_tool.py -o ~/

It always executes the python application and doc generation stops at 21%. The same behaviour when i use the epydocgui.

When I test it on a simple hello world program everything works fine. The file has > 1000 lines so i can't post it. The program itself works fine.

Has anbody any idea why does it happen? Can wrong formatting be a problem though a couldn't find any yet.

Thx 4 help

1

There are 1 best solutions below

1
chepner On

Without seeing your code, it's hard to say what the problem is. However, it sounds as if the code to start the application is not protected by a if __name__ == '__main__': statement, so the application is run when epydoc imports the file. Two things that might help:

  1. Fix storage_config_tool.py so that only class, def, and assignment statements are executed when the module is imported.

  2. Use epydoc --html --parse-only storage_config_tool.py -o ~/ to generate the documentation. This skips the module import step, which may or may not be necessary for generating the complete documentation.