citeproc-py icon indicating copy to clipboard operation
citeproc-py copied to clipboard

AttributeError: 'NoneType' object has no attribute 'single'

Open yarikoptic opened this issue 8 years ago • 2 comments

Happens with

(Pdb) p bibliography.items
[CitationItem(mckinney-proc-scipy-2010)]

where that entry as in #37 bibtex example (but I believe happened before on another one as well). Here is a full traceback:

Traceback (most recent call last):
  File "/home/yoh/proj/duecredit/venv/bin/duecredit", line 9, in <module>
    load_entry_point('duecredit===0.4.3-1-g4709', 'console_scripts', 'duecredit')()
  File "/home/yoh/proj/duecredit/duecredit/cmdline/main.py", line 171, in main
    args.func(args)
  File "/home/yoh/proj/duecredit/duecredit/cmdline/cmd_summary.py", line 56, in run
    out.dump()
  File "/home/yoh/proj/duecredit/duecredit/io.py", line 214, in dump
    self.fd.write(get_text_rendering(citations_fromentrykey[key], style=self.style))
  File "/home/yoh/proj/duecredit/duecredit/io.py", line 226, in get_text_rendering
    return format_bibtex(entry, style=style)
  File "/home/yoh/proj/duecredit/duecredit/io.py", line 273, in format_bibtex
    biblio_out = bibliography.bibliography()
  File "/home/yoh/proj/misc/citeproc-py/citeproc/frontend.py", line 105, in bibliography
    return self.style.render_bibliography(self.items)
  File "/home/yoh/proj/misc/citeproc-py/citeproc/frontend.py", line 75, in render_bibliography
    return self.root.bibliography.render(citation_items)
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 256, in render
    return self.layout.render_bibliography(citation_items)
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 641, in render_bibliography
    text = self.format(self.wrap(self.render_children(item)))
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 582, in render_children
    text = child.render(item, **kwargs)
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 660, in render
    text, language = self.process(*args, **kwargs)
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 674, in process
    text = self.get_macro(self.get('macro')).render(item, context)
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 600, in render
    sort_options=sort_options)
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 582, in render_children
    text = child.render(item, **kwargs)
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 97, in render
    return self.markup(self.process(*args, **kwargs))
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 1060, in process
    text = name_elem.render(item, role, context=context, **kwargs)
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 97, in render
    return self.markup(self.process(*args, **kwargs))
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 1168, in process
    et_al = self.et_al()
  File "/home/yoh/proj/misc/citeproc-py/citeproc/model.py", line 1131, in et_al
    result = self.get_term('et-al').single
AttributeError: 'NoneType' object has no attribute 'single'

yarikoptic avatar Nov 08 '15 03:11 yarikoptic

I can't reproduce this. Are you specifying a locale to CitationStylesStyle? If so, which one? If not, can you provide the full script where this happens?

brechtm avatar Jan 04 '16 21:01 brechtm

I encountered this many times on my dataset. I believe this is fixed with #45

jayvdb avatar Jan 05 '16 00:01 jayvdb