Opened 18 years ago

Last modified 17 years ago

#164 assigned defect

Pydoc Heisenbugs

Reported by: Noah Kantrowitz Owned by: Alec Thomas
Priority: normal Component: PyDocPlugin
Severity: major Keywords:
Cc: Trac Release:


I am getting really weird, seemingly random glitches from the Pydoc plugin.

Things like it will say that no documentation is found for a file, but if I refresh a few times it might show me the docs, and then go back to "not found" the next time I load the page.

Below is a traceback from on of the common errors. This error will also sometimes show up on a wiki page if I have used a [pydoc:] link on it.

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/web/", line 206, in handler
    dispatch_request(mpr.path_info, mpr, env)
  File "/usr/lib/python2.4/site-packages/trac/web/", line 139, in dispatch_request
  File "/usr/lib/python2.4/site-packages/trac/web/", line 107, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.4/site-packages/trac/wiki/", line 116, in process_request
    self._render_view(req, db, page)
  File "/usr/lib/python2.4/site-packages/trac/wiki/", line 364, in _render_view
    req.hdf['wiki.page_html'] = wiki_to_html(page.text, self.env, req)
  File "/usr/lib/python2.4/site-packages/trac/wiki/", line 744, in wiki_to_html
    Formatter(env, req, absurls, db).format(wikitext, out, escape_newlines)
  File "/usr/lib/python2.4/site-packages/trac/wiki/", line 599, in format
    result = re.sub(self.rules, self.replace, line)
  File "/usr/lib/python2.4/", line 142, in sub
    return _compile(pattern, 0).sub(repl, string, count)
  File "/usr/lib/python2.4/site-packages/trac/wiki/", line 221, in replace
    return getattr(self, '_' + itype + '_formatter')(match, fullmatch)
  File "/usr/lib/python2.4/site-packages/trac/wiki/", line 290, in _lhref_formatter
    return self._make_link(ns, target, match, label)
  File "/usr/lib/python2.4/site-packages/trac/wiki/", line 295, in _make_link
    util.escape(label, False))
  File "build/bdist.linux-i686/egg/tracpydoc/", line 322, in _pydoc_formatter
  File "build/bdist.linux-i686/egg/tracpydoc/", line 195, in load_object
  File "/var/www/gopetsdev/head/snofight/", line 3, in ?
    import pygame, sys
  File "/usr/lib/python2.4/site-packages/pygame/", line 71, in ?
    Color = color.Color
NameError: name 'color' is not defined

Attachments (0)

Change History (5)

comment:1 Changed 18 years ago by Noah Kantrowitz

As a partial work around, I have set up the GeneralLinkSyntax plugin? to provide the [pydoc:foo] wiki syntax (to /pydoc/%s)

comment:2 Changed 18 years ago by Alec Thomas

Your version seems to be modified, line 322 of is

return '<a class="wiki" href="%s">%s</a>' % \
       (formatter.href.pydoc(), label)

Can you revert to trunk and try again?

comment:3 Changed 18 years ago by Alec Thomas

Owner: changed from alect to Alec Thomas
Status: newassigned

Try this patch, it unloads each module after it generates the documentation:

  • tracpydoc/

    237237            return "No Python documentation found for '%s'" % target
    239239    def _makedoc(self, target, visibility):
     240        already_imported = sys.modules.copy()
    240241        module, object = self.load_object(target)
    241242        try:
    242243            self.makedoc_lock.acquire()
    263264            else:
    264265                return self.doc.document(object)
    265266        finally:
     267            for modname in sys.modules.copy():
     268                if modname not in already_imported:
     269                    self.env.log.debug("Unloading module %s" % modname)
     270                    del(sys.modules[modname])
    266271            self.makedoc_lock.release()
    268273    # INavigationContributor methods

comment:4 Changed 18 years ago by Alec Thomas

Do you get this issue with anything other than pygame?

comment:5 Changed 18 years ago by Noah Kantrowitz

That patch didn't seem to help.

My install is here, so you can look around to see whats happening.

Modify Ticket

Change Properties
Set your email in Preferences
as assigned The owner will remain Alec Thomas.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.