Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'pending_xref' object has no attribute 'startswith' #299

Closed
lzytniak opened this issue Jan 2, 2017 · 5 comments
Closed
Assignees
Labels
duplicate Duplicate issue

Comments

@lzytniak
Copy link

lzytniak commented Jan 2, 2017

Subject: Exception occurred: AttributeError: 'pending_xref' object has no attribute 'startswith'

Problem

<breathe.parser.compound.paramTypeSub instance at 0xfb1c908>
<pending_xref refdomain="std" refexplicit="True" refid="cppTangode/ddf/namespaceTango_1a86ed7ac243c13a7813f08c3b899af170" reftarget="cppTangode/ddf/namespaceTango_1a86ed7ac243c13a7813f08c3b899af170" reftype="ref">CmdArgType</pending_xref>

Exception occurred:
File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 987, in visit_param
if first_node.startswith(keyword + ' '):
AttributeError: 'pending_xref' object has no attribute 'startswith'
The full traceback has been saved in /tmp/sphinx-err-Zr2EVu.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at https://github.com/sphinx-doc/sphinx/issues. Thanks!
make: *** [html] Error 1

Procedure to reproduce the problem

make html

Error logs / results

# Last messages:
#   Running Sphinx v1.4.8
#   making output directory...
#   loading pickled environment...
#   not yet created
#   building [mo]: targets for 0 po files that are out of date
#   building [html]: targets for 2 source files that are out of date
#   updating environment:
#   2 added, 0 changed, 0 removed
#   reading sources... [ 50%] docbook/index
#   reading sources... [100%] index
# Loaded extensions:
#   breathe (4.4.0) from /usr/lib/python2.7/site-packages/breathe/__init__.pyc
#   alabaster (0.7.9) from /usr/lib/python2.7/site-packages/alabaster/__init__.pyc
#   sphinx.ext.imgmath (1.4.8) from /usr/lib/python2.7/site-packages/sphinx/ext/imgmath.pyc
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/sphinx/cmdline.py", line 244, in main
    app.build(opts.force_all, filenames)
  File "/usr/lib/python2.7/site-packages/sphinx/application.py", line 297, in build
    self.builder.build_update()
  File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 251, in build_update
    'out of date' % len(to_build))
  File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 265, in build
    self.doctreedir, self.app))
  File "/usr/lib/python2.7/site-packages/sphinx/environment.py", line 569, in update
    self._read_serial(docnames, app)
  File "/usr/lib/python2.7/site-packages/sphinx/environment.py", line 589, in _read_serial
    self.read_doc(docname, app)
  File "/usr/lib/python2.7/site-packages/sphinx/environment.py", line 742, in read_doc
    pub.publish()
  File "/usr/lib/python2.7/site-packages/docutils/core.py", line 217, in publish
    self.settings)
  File "/usr/lib/python2.7/site-packages/sphinx/io.py", line 49, in read
    self.parse()
  File "/usr/lib/python2.7/site-packages/docutils/readers/__init__.py", line 78, in parse
    self.parser.parse(self.input, document)
  File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/__init__.py", line 172, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 170, in run
    input_source=document['source'])
  File "/usr/lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/usr/lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2301, in explicit_markup
    self.explicit_list(blank_finish)
  File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2331, in explicit_list
    match_titles=self.state_machine.match_titles)
  File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 319, in nested_list_parse
    node=node, match_titles=match_titles)
  File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 195, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/usr/lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/usr/lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2604, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2311, in explicit_construct
    return method(self, expmatch)
  File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2054, in directive
    directive_class, match, type_name, option_presets)
  File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2103, in run_directive
    result = directive_instance.run()
  File "/usr/lib/python2.7/site-packages/breathe/directive/index.py", line 90, in run
    return self.handle_contents(project_info)
  File "/usr/lib/python2.7/site-packages/breathe/directive/index.py", line 59, in handle_contents
    node_list = object_renderer.render(context.node_stack[0], context)
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 1158, in render
    result = method(self, node)
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 345, in visit_doxygen
    nodelist.extend(self.render(compound))
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 1158, in render
    result = method(self, node)
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 1090, in dispatch_compound
    return self.visit_compound(node)
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 389, in visit_compound
    name, kind)
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 380, in render_signature
    template_signode = self.create_template_node(file_data.compounddef)
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 244, in create_template_node
    nodes.extend(self.render(decl.templateparamlist))
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 1158, in render
    result = method(self, node)
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 1078, in visit_templateparamlist
    nodelist.extend(self.render(item))
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 1158, in render
    result = method(self, node)
  File "/usr/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 987, in visit_param
    if first_node.startswith(keyword + ' '):
AttributeError: 'pending_xref' object has no attribute 'startswith'

Expected results

build html

Environment info

  • OS: CentOS 7.2
  • Sphinx version: 1.4.8
  • Python version: 2.7.5 (CPython)
  • Docutils version: 0.11 repository
  • Jinja2 version: 2.7.2
@vitaut
Copy link
Contributor

vitaut commented Jan 3, 2017

Should be fixed by #288.

@kratsg
Copy link

kratsg commented Apr 15, 2017

Hi, I'm still seeing this error unfortunately (I'm using breathe 4.6.0)

Exception occurred:
  File "/Users/kratsg/.virtualenvs/xAH/lib/python2.7/site-packages/breathe/renderer/sphinxrenderer.py", line 990, in update_signature_with_initializer
    if not nodes[0].startswith('='):
AttributeError: 'pending_xref' object has no attribute 'startswith'
The full traceback has been saved in /var/folders/cz/ysr8lt_90z37zyb25ds1sjcr0000gn/T/sphinx-err-yVusee.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

Full traceback is here: https://gist.github.com/4a29a821f37c5df3f73492b20426c734

@vermeeren
Copy link
Collaborator

Could someone confirm this this is still an issue with the latest Sphinx (1.7.5) + Breathe (4.9.0) combination? Thanks.

@vermeeren vermeeren added bug Problem in existing code code Source code labels Jun 2, 2018
@vermeeren vermeeren self-assigned this Jun 2, 2018
@kratsg
Copy link

kratsg commented Jun 3, 2018

I checked locally with UCATLAS/xAODAnaHelpers and it looks ok. Note that we depend on ReadTheDocs for this -- so I don't think they've updated their version yet.

@vermeeren
Copy link
Collaborator

vermeeren commented Jun 3, 2018

Actually, I think I just fixed the actual bug in 4.9.1 and only now I realise.

Issue #381 reported this happening with code that worked fine before #380 was merged. #382 (4.9.1) fixed this. #380 added improved rendering by rendering newlines as paragraph. Before only <linebreak> tags were translated into paragraph, after that PR also \n.

update_signature_with_initializer function did not handle paragraph type at all, causing this error. With added \n support the problem happened in many more projects.


TL;DR

Please comment if you still experience this issue with 4.9.1.

@vermeeren vermeeren added duplicate Duplicate issue and removed bug Problem in existing code code Source code labels Jun 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Duplicate issue
Projects
None yet
Development

No branches or pull requests

4 participants