Modify

Opened 8 years ago

Last modified 7 years ago

#164 assigned defect

Pydoc Heisenbugs

Reported by: coderanger Owned by: athomas
Priority: normal Component: PyDocPlugin
Severity: major Keywords:
Cc: Trac Release:

Description

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/modpython_frontend.py", line 206, in handler
    dispatch_request(mpr.path_info, mpr, env)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 139, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 107, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.4/site-packages/trac/wiki/web_ui.py", line 116, in process_request
    self._render_view(req, db, page)
  File "/usr/lib/python2.4/site-packages/trac/wiki/web_ui.py", 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/formatter.py", 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/formatter.py", line 599, in format
    result = re.sub(self.rules, self.replace, line)
  File "/usr/lib/python2.4/sre.py", line 142, in sub
    return _compile(pattern, 0).sub(repl, string, count)
  File "/usr/lib/python2.4/site-packages/trac/wiki/formatter.py", line 221, in replace
    return getattr(self, '_' + itype + '_formatter')(match, fullmatch)
  File "/usr/lib/python2.4/site-packages/trac/wiki/formatter.py", line 290, in _lhref_formatter
    return self._make_link(ns, target, match, label)
  File "/usr/lib/python2.4/site-packages/trac/wiki/formatter.py", line 295, in _make_link
    util.escape(label, False))
  File "build/bdist.linux-i686/egg/tracpydoc/tracpydoc.py", line 322, in _pydoc_formatter
  File "build/bdist.linux-i686/egg/tracpydoc/tracpydoc.py", line 195, in load_object
  File "/var/www/gopetsdev/head/snofight/main.py", line 3, in ?
    import pygame, sys
  File "/usr/lib/python2.4/site-packages/pygame/__init__.py", line 71, in ?
    Color = color.Color
NameError: name 'color' is not defined

Attachments (0)

Change History (5)

comment:1 Changed 8 years ago by coderanger

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 8 years ago by athomas

Your version seems to be modified, line 322 of tracpydoc.py is

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

Can you revert to trunk and try again?

comment:3 Changed 8 years ago by athomas

  • Owner changed from alect to athomas
  • Status changed from new to assigned

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

  • tracpydoc/tracpydoc.py

     
    237237            return "No Python documentation found for '%s'" % target 
    238238 
    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() 
    267272     
    268273    # INavigationContributor methods 

comment:4 Changed 8 years ago by athomas

Do you get this issue with anything other than pygame?

comment:5 Changed 8 years ago by coderanger

That patch didn't seem to help.

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

Add Comment

Modify Ticket

Action
as assigned .
Author


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

 
Note: See TracTickets for help on using tickets.