Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#249 Troubles in cli.UnifiedProgressConsoleLogger

closed-fixed
nobody
None
5
2008-02-02
2008-02-01
Jürgen Urner
No

Epydoc 3.0.1
I get the following traceback when running epydoc
over my project:

Traceback (most recent call last):
File "gen_docs.py", line 23, in <module>
cli.cli()
File "/usr/lib/python2.5/site-packages/epydoc/cli.py", line 965, in cli
main(options, names)
File "/usr/lib/python2.5/site-packages/epydoc/cli.py", line 757, in main
exclude_parse=exclude_parse)
File "/usr/lib/python2.5/site-packages/epydoc/docbuilder.py", line 206, in build_doc_index
doc_pairs = _get_docs_from_items(items, options)
File "/usr/lib/python2.5/site-packages/epydoc/docbuilder.py", line 398, in _get_docs_from_items
item, doc_pairs[-1], options, progress_estimator)
File "/usr/lib/python2.5/site-packages/epydoc/docbuilder.py", line 595, in _get_docs_from_submodules
module_filename, options, progress_estimator, pkg_docs)
File "/usr/lib/python2.5/site-packages/epydoc/docbuilder.py", line 522, in _get_docs_from_module_file
'%s (%s)' % (modulename, filename))
File "/usr/lib/python2.5/site-packages/epydoc/log.py", line 200, in progress
for logger in _loggers: logger.progress(percent, '%s' % message)
File "/usr/lib/python2.5/site-packages/epydoc/cli.py", line 1350, in progress
p = ((sum(self.stages[:i]) + percent*self.stages[i]) /
IndexError: list index out of range

------------------------------------------------
i = 9
self.stages = [40, 7, 1, 3, 1, 30, 1, 2, 100]

Discussion

  • Edward Loper
    Edward Loper
    2008-02-01

    Logged In: YES
    user_id=195958
    Originator: NO

    I assume that gen_docs.py is your own file. I assume that you're calling epydoc.cli.cli() multiple times? If so, then I think that's the problem -- epydoc's cli script registers a logger when it starts running, but does not deregister it when it's done. As a result, you get two loggers registered, and the first one (which thinks it's already run through all the appropriate stages of documentation) gets confused. Really, epydoc's cli script should deregister its own logger -- I'll fix that when I get a chance -- but in the meantime, you can use the following minor hack to clear epydoc's logger before you call cli.cli() a second (or third) time:

    import epydoc.log
    del epydoc.log._loggers[:]

    Please let me know whether this is indeed the source of the problem and whether the minor hack fixes the issue for you. Thanks.

     
  • Edward Loper
    Edward Loper
    2008-02-01

    Logged In: YES
    user_id=195958
    Originator: NO

    svn revision 1704 modifies epydoc.cli.main() to deregister any loggers that it registered before it exits.

     
  • Jürgen Urner
    Jürgen Urner
    2008-02-02

    Logged In: YES
    user_id=1660798
    Originator: YES

    thanks for the hack... and the safety note to always __name__ == '__main__' scripts ;-)

     
  • Edward Loper
    Edward Loper
    2008-02-02

    • status: open --> closed-fixed