1. arjones6
  2. sphinx-numfig
Issue #6 new

NotImplementedError: Unknown node: num_ref

Christian Jann
created an issue

Hi, I've copied numfig.py to sphinx/sphinx/ext/ and than rebuild sphinx sudo python setup.py install, added it to conf.py extensions = [..., 'sphinx.ext.numfig'] and tried the

:num:`figure #example-fig`

but now make html fails:

writing output... [ 69%] parts
Exception occurred:
  File "/usr/lib/python2.7/site-packages/Sphinx-1.2pre_b1f4b336ab8ddev_20130102-py2.7.egg/sphinx/writers/html.py", line 552, in unknown_visit
    raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
NotImplementedError: Unknown node: num_ref
The full traceback has been saved in /tmp/sphinx-err-wusN6e.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.
Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-users/>,
or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
make: *** [html] Error 1
[chris@thinkpad ~]$ cat /tmp/sphinx-err-wusN6e.log
# Sphinx version: 1.2pre
# Python version: 2.7.3
# Docutils version: 0.8.1 release
# Jinja2 version: 2.6
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Sphinx-1.2pre_b1f4b336ab8ddev_20130102-py2.7.egg/sphinx/cmdline.py", line 198, in main
    app.build(force_all, filenames)
  File "/usr/lib/python2.7/site-packages/Sphinx-1.2pre_b1f4b336ab8ddev_20130102-py2.7.egg/sphinx/application.py", line 204, in build
    self.builder.build_update()
  File "/usr/lib/python2.7/site-packages/Sphinx-1.2pre_b1f4b336ab8ddev_20130102-py2.7.egg/sphinx/builders/__init__.py", line 196, in build_update
    'out of date' % len(to_build))
  File "/usr/lib/python2.7/site-packages/Sphinx-1.2pre_b1f4b336ab8ddev_20130102-py2.7.egg/sphinx/builders/__init__.py", line 252, in build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/lib/python2.7/site-packages/Sphinx-1.2pre_b1f4b336ab8ddev_20130102-py2.7.egg/sphinx/builders/__init__.py", line 292, in write
    self.write_doc(docname, doctree)
  File "/usr/lib/python2.7/site-packages/Sphinx-1.2pre_b1f4b336ab8ddev_20130102-py2.7.egg/sphinx/builders/html.py", line 419, in write_doc
    self.docwriter.write(doctree, destination)
  File "/usr/lib/python2.7/site-packages/docutils/writers/__init__.py", line 77, in write
    self.translate()
  File "/usr/lib/python2.7/site-packages/Sphinx-1.2pre_b1f4b336ab8ddev_20130102-py2.7.egg/sphinx/writers/html.py", line 41, in translate
    self.document.walkabout(visitor)
  File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 165, in walkabout
    visitor.dispatch_visit(self)
  File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 1604, in dispatch_visit
    return method(node)
  File "/usr/lib/python2.7/site-packages/Sphinx-1.2pre_b1f4b336ab8ddev_20130102-py2.7.egg/sphinx/writers/html.py", line 552, in unknown_visit
    raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
NotImplementedError: Unknown node: num_ref

Any hints what to do?

Comments (4)

  1. Christian Jann reporter

    Problem solved, don't use special characters.

    This won't work:

    See :num:`figure #example_fig` on page :page:`example_fig` for the figure labeled :ref:`example_fig`.
    
    .. _example_fig:
    
    .. figure:: example_figure.png
    
        Example figure
    

    This works:

    See :num:`figure #example-fig` on page :page:`example-fig` for the figure labeled :ref:`example-fig`.
    
    .. _example-fig:
    
    .. figure:: example_figure.png
    
        Example figure
    
  2. rrieber

    With no special characters in my references, I still had this issue. I think this is a valid bug, although I'm not sure exactly how to recreate it. I think I've discovered a fix though.

  3. rrieber

    Here is my fix:

    bash-3.2$ diff numfig.py numfig_orig.py 
    19,22d18
    < def skip_num_ref(self, node):
    <     raise SkipNode
    < 
    < 
    105,106c101
    <                  latex=(latex_visit_num_ref, None),
    <                  html=(skip_num_ref, None))
    ---
    >                  latex=(latex_visit_num_ref, None))
    

    Looks like num_ref was never defined for HTML visits. You must run make html first.

    bash-3.2$ make clean
    rm -rf build/*
    bash-3.2$ make latex
    /opt/local/bin/sphinx-build-2.7 -b latex -d build/doctrees   source build/latex
    Making output directory...
    Running Sphinx v1.1.3
    Copying image files to latex directory
            cp ./support/*.png ../build/latex/
    loading pickled environment... not yet created
    building [latex]: all documents
    updating environment: 6 added, 0 changed, 0 removed
    reading sources... [100%] sections/introduction                                                                                                                                                                                                                                        
    looking for now-outdated files... none found
    pickling environment... done
    checking consistency... done
    processing filename.tex... index sections/introduction sections/SAR sections/RAD sections/infidelities appendix/glossary 
    resolving references...
    writing... done
    copying images... <MANY IMAGES HERE>
    copying TeX support files... done
    build succeeded.
    
    Build finished; the LaTeX files are in build/latex.
    Run `make' in that directory to run these through (pdf)latex (use `make latexpdf' here to do that automatically).
    bash-3.2$ make html
    /opt/local/bin/sphinx-build-2.7 -b html -d build/doctrees   source build/html
    Making output directory...
    Running Sphinx v1.1.3
    Copying image files to latex directory
            cp ./support/*.png ../build/latex/
    loading pickled environment... done
    building [html]: targets for 6 source files that are out of date
    updating environment: 0 added, 0 changed, 0 removed
    looking for now-outdated files... none found
    preparing documents... done
    writing output... [ 66%] sections/SAR                                                                                                                                                                                                                                                  
    Exception occurred:
      File "path/to/numfig.py", line 80, in doctree_resolved
        target_doc = app.builder.env.figid_docname_map[target]
    KeyError: u'msbfirstsar'
    The full traceback has been saved in /var/folders/vK/vKG7oCo5G0qU6akdidGktk+++TM/-Tmp-/sphinx-err-InqJgM.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.
    Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-dev/>,
    or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
    make: *** [html] Error 1
    

    But instead, if I run make html first...

    bash-3.2$ make clean
    rm -rf build/*
    bash-3.2$ make html
    /opt/local/bin/sphinx-build-2.7 -b html -d build/doctrees   source build/html
    Making output directory...
    Running Sphinx v1.1.3
    Copying image files to latex directory
            cp ./support/*.png ../build/latex/
    loading pickled environment... not yet created
    building [html]: targets for 6 source files that are out of date
    updating environment: 6 added, 0 changed, 0 removed
    reading sources... [100%] sections/introduction                                                                                                                                                                                                                                        
    looking for now-outdated files... none found
    pickling environment... done
    checking consistency... done
    preparing documents... done
    writing output... [100%] sections/introduction                                                                                                                                                                                                                                         
    writing additional files... genindex search
    copying images... [100%] sections/../images/Frame_low_SAR.png                                                                                                                                                                                                                          
    copying static files... done
    dumping search index... done
    dumping object inventory... done
    build succeeded.
    
    Build finished. The HTML pages are in build/html.
    bash-3.2$ make latex
    /opt/local/bin/sphinx-build-2.7 -b latex -d build/doctrees   source build/latex
    Running Sphinx v1.1.3
    Copying image files to latex directory
            cp ./support/*.png ../build/latex/
    loading pickled environment... done
    building [latex]: all documents
    updating environment: 0 added, 0 changed, 0 removed
    looking for now-outdated files... none found
    processing filename.tex... index sections/introduction sections/SAR sections/RAD sections/infidelities appendix/glossary 
    resolving references...
    writing... done
    copying images... <MANY IMAGES HERE>
    copying TeX support files... done
    build succeeded.
    
    Build finished; the LaTeX files are in build/latex.
    Run `make' in that directory to run these through (pdf)latex (use `make latexpdf' here to do that automatically).
    

    This works. Reference Issue #7

  4. Log in to comment