Coder Social home page Coder Social logo

pydoctor throws AttributeError about pydoctor HOT 7 CLOSED

twisted avatar twisted commented on June 21, 2024
pydoctor throws AttributeError

from pydoctor.

Comments (7)

mwhudson avatar mwhudson commented on June 21, 2024

(by mwhudson)
Is this pydoctor from current trunk?

Can you poke around using pydoctor --pdb and try to see what code is triggering the problem. I imagine it could be something like:

import name

class name: pass

class subclass(name): pass

from pydoctor.

mwhudson avatar mwhudson commented on June 21, 2024

(by allo)
the problem is introduced by
http://git.otfbot.org/otfbot.git/commit/?id=3d66cac6201080875075726fb71fccaee3ada133

from pydoctor.

mwhudson avatar mwhudson commented on June 21, 2024

(by allo)
what's the status of this bug?
will it be fixed anytime soon?

from pydoctor.

mwhudson avatar mwhudson commented on June 21, 2024

(by mwhudson)
I understand the problem, at least to some extent.

The basic problem is that I assumed Python was more consistent than it is :-) The way names in import statements is resolved is somewhat different to how names in general are resolved, in particular when a package init defines a name that collides with a module.

I'll get it fixed I guess, but it might take a while, I'm afraid. Knowing you care helps motivate me!

from pydoctor.

mwhudson avatar mwhudson commented on June 21, 2024

(by allo)
oh, thanks for the feedback on the issue.

i tried a bit, the problem is the init.py in the package pluginSupport. Delete it, and it works. you see it in the linked git commit.

there seems to be a problem, that both the package and a file have the name pluginSupport. if i move pluginSupport.py to plSupport.py, i get an error in the html-generation, not in the subclasses place.

another thing i tried (without understand much of your code) is "if o:" -> 'if o and hasattr(o, "subclasses"):'. this also moves the exception to another place.

the error with plSupport.py instead of pluginSupport.py:

writing html to doc/api/ using pydoctor.html.SystemWriter
Traceback (most recent call last):
File "/usr/bin/pydoctor", line 5, in
main(sys.argv[1:])
File "/usr/lib/pymodules/python2.6/pydoctor/driver.py", line 287, in main
writer.writeIndividualFiles(subjects, options.htmlfunctionpages)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 185, in writeIndividualFiles
self.writeIndividualFiles(sub.orderedcontents, functionpages)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 185, in writeIndividualFiles
self.writeIndividualFiles(sub.orderedcontents, functionpages)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 185, in writeIndividualFiles
self.writeIndividualFiles(sub.orderedcontents, functionpages)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 185, in writeIndividualFiles
self.writeIndividualFiles(sub.orderedcontents, functionpages)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 185, in writeIndividualFiles
self.writeIndividualFiles(sub.orderedcontents, functionpages)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 181, in writeIndividualFiles
html = self.getHTMLFor(sub)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 194, in getHTMLFor
d = fun(o)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 316, in html_TwistedClass
x += self.genChildren(cls.orderedcontents, link=link)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 370, in _genChildren
'doc': summaryDoc(obj)}
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 30, in summaryDoc
return doc2html(obj, doc)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 53, in g
r = _cache[args] = f(*args)
File "/usr/lib/pymodules/python2.6/pydoctor/html.py", line 84, in doc2html
crap = pdoc.to_html(_EpydocLinker(obj))
AttributeError: 'NoneType' object has no attribute 'to_html'

from pydoctor.

mwhudson avatar mwhudson commented on June 21, 2024

(by mwhudson)
The branch I've just linked to the report contains a failing test case which is the crux of the issue I think.

It's also a bug that pydoctor blows up in the way it does, if it misinterprets what's going on that's one thing, but it shouldn't blow up like this.

I'm not sure what the real fix for this is. It probably is the thing I mentioned first -- the lookup path for import statements and python expressions are not quite the same. That might be quite a large change though, and it might be possible to bodge it more simply. Not sure if that would be a good idea though.

from pydoctor.

mthuurne avatar mthuurne commented on June 21, 2024

Since the code changed significantly in the last 10 years, I'm going to assume this issue has been fixed at some point. Therefore I'm closing this report. I do agree that pydoctor should never crash, no matter how complex the code it's analyzing, so if something similar happens again, please open a new issue.

We're gradually adopting mypy now, so unexpected None values should become a thing of the past.

from pydoctor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.