Hi Komiya,
Certainly, sorry for the delay it is has been a crushing week. I
appreciated your input . The fill stack trace from the log file is below:
# Sphinx version: 1.6.2
# Python version: 3.6.1 (CPython)
# Docutils version: 0.13.1 release
# Jinja2 version: 2.9.6
# Last messages:
# copying bokeh-plot files... [ 97%]
bokeh-plot-fbef5a55095a57bd7ec69880b9e491c1.js
#
# copying bokeh-plot files... [ 98%]
bokeh-plot-fbffcff58bf2df95017e1a6470add3f2.js
#
# copying bokeh-plot files... [ 99%]
bokeh-plot-fc686a29565cec5272ecc418812f2401.js
#
# copying bokeh-plot files... [100%]
bokeh-plot-ff7d4e4a58f23d8a18428273c04d26ea.js
#
#
#
# Loaded extensions:
# alabaster (0.7.10) from
/Users/bryan/anaconda/lib/python3.6/site-packages/alabaster/__init__.py
# sphinx.ext.autodoc (1.6.2) from
/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/ext/autodoc.py
# sphinx.ext.autosummary (1.6.2) from
/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/ext/autosummary/__init__.py
# sphinx.ext.ifconfig (1.6.2) from
/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/ext/ifconfig.py
# sphinx.ext.napoleon (1.6.2) from
/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/ext/napoleon/__init__.py
# sphinx.ext.intersphinx (1.6.2) from
/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/ext/intersphinx.py
# sphinx.ext.viewcode (1.6.2) from
/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/ext/viewcode.py
# bokeh.sphinxext.bokeh_autodoc (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_autodoc.py
# bokeh.sphinxext.bokeh_enum (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_enum.py
# bokeh.sphinxext.bokeh_gallery (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_gallery.py
# bokeh.sphinxext.bokeh_github (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_github.py
# bokeh.sphinxext.bokeh_jinja (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_jinja.py
# bokeh.sphinxext.bokeh_index_toctree (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_index_toctree.py
# bokeh.sphinxext.bokeh_model (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_model.py
# bokeh.sphinxext.bokeh_options (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_options.py
# bokeh.sphinxext.bokeh_palette (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_palette.py
# bokeh.sphinxext.bokeh_palette_group (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_palette_group.py
# bokeh.sphinxext.bokeh_plot (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_plot.py
# bokeh.sphinxext.bokeh_prop (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_prop.py
# bokeh.sphinxext.bokeh_sitemap (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/bokeh_sitemap.py
# bokeh.sphinxext.collapsible_code_block (unknown version) from
/Users/bryan/work/bokeh/bokeh/sphinxext/collapsible_code_block.py
Traceback (most recent call last):
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/cmdline.py",
line 306, in main
app.build(opts.force_all, filenames)
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/application.py",
line 339, in build
self.builder.build_update()
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/builders/__init__.py",
line 328, in build_update
'out of date' % len(to_build))
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/builders/__init__.py",
line 341, in build
updated_docnames = set(self.env.update(self.config, self.srcdir,
self.doctreedir))
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/environment/__init__.py",
line 584, in update
self._read_serial(docnames, self.app)
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/environment/__init__.py",
line 603, in _read_serial
self.read_doc(docname, app)
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/environment/__init__.py",
line 733, in read_doc
app.emit('doctree-read', doctree)
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/application.py",
line 489, in emit
return self.events.emit(event, self, *args)
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/events.py",
line 79, in emit
results.append(callback(*args))
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/environment/collectors/asset.py",
line 51, in process_doc
docname = app.env.docname
File
"/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/environment/__init__.py",
line 785, in docname
return self.temp_data['docname']
KeyError: 'docname'
Let me know if I can provide any more input or information.
Thanks,
Bryan
On Sunday, June 25, 2017 at 6:57:57 AM UTC-5, Komiya Takeshi wrote:
>
> Hi Bryan,
>
> Sphinx sets `env.docname` during reading docs (env.read_doc()). So I
> feel a bit strange your situation.
> Could you share stacktrace of the error?
>
> Thanks,
> Takeshi KOMIYA
>
> 2017-06-24 6:27 GMT+09:00 Bryan Van de ven <[email protected]
> <javascript:>>:
> > Hi All,
> >
> > I've developed a "bokeh-gallery" extension to help with automating our
> > project documentation. It is used to generate the gallery below:
> >
> > http://bokeh.pydata.org/en/latest/docs/gallery.html
> >
> > After trying to update from Sphinx 1.5.x to 1.6.x, I get the following
> > exception:
> >
> > Exception occurred:
> > File
> >
> "/Users/bryan/anaconda/lib/python3.6/site-packages/Sphinx-1.6.2-py3.6.egg/sphinx/environment/__init__.py",
>
>
> > line 785, in docname
> > return self.temp_data['docname']
> > KeyError: 'docname'
> >
> >
> > The full code for the extension is here:
> >
> >
> >
> https://github.com/bokeh/bokeh/blob/master/bokeh/sphinxext/bokeh_gallery.py
> >
> > But i've included the just the "run: code, which seems the be the
> problem
> > below. (It's been updated with a workaround I describe below) The
> extension
> > works by reading a JSON config that lists gallery files, then reading
> doc
> > for all these in a loop. Then it generates some RST txt with ".. image"
> > links to the docs generated in the links, which it passes to
> self._parse.
> > It's this step that fails. Evidently now the value of env.docname is
> erased
> > during the loop that reads docs. When self._parse is called with the
> > generated RST txt, the image collector tries to access env.docname,
> > resulting in the exception above.
> >
> > I can "fix" this by saving the docname before the loop, then setting
> > env.temp_data['docname'] = current_docname as seen below. But this seems
> > like a pretty bad workaround. What is the right way to do what I am
> doing,
> > which is basically:
> >
> > * read in a bunch of files and generate docs for them
> > * generate a string of RST text for the current doc
> > * parse that dynamically generated RST text
> >
> > Thanks for any guidance,
> >
> > Bryan
> >
> > class BokehGalleryDirective(BokehDirective):
> >
> >
> > has_content = False
> > required_arguments = 1
> >
> >
> > def run(self):
> > env = self.state.document.settings.env
> > app = env.app
> >
> >
> > current_docname = env.docname
> > docdir = dirname(env.doc2path(current_docname))
> >
> >
> > dest_dir = join(docdir, "gallery")
> > ensuredir(dest_dir)
> >
> >
> > specpath = join(docdir, self.arguments[0])
> > env.note_dependency(specpath)
> > spec = json.load(open(specpath))
> > details = spec['details']
> >
> >
> > details_iter = status_iterator(details,
> > 'copying gallery files... ',
> > "brown",
> > len(details),
> > app.verbosity,
> > lambda x: x['name'] + ".py")
> >
> >
> > env.gallery_updated = []
> > for detail in details_iter:
> > src_path = abspath(join("..", detail['path']))
> > dest_path = join(dest_dir, detail['name'] + ".py")
> >
> >
> > # sphinx pickled env works only with forward slash
> > docname = join(env.app.config.bokeh_gallery_dir,
> > detail['name']).replace("\\","/")
> >
> >
> > try:
> > copyfile(src_path, dest_path)
> > except OSError as e:
> > raise SphinxError('cannot copy gallery file %r, reason:
> %s'
> > % (src_path, e))
> >
> >
> > try:
> > env.clear_doc(docname)
> > env.read_doc(docname, app=app)
> > env.gallery_updated.append(docname)
> > except Exception as e:
> > raise SphinxError('failed to read gallery doc %r,
> reason:
> > %s' % (docname, e))
> >
> >
> > names = [detail['name']for detail in details]
> > rst_text = GALLERY_PAGE.render(names=names)
> >
> >
> > # current docname has been cleared, not sure a better way to
> restore
> > env.temp_data['docname'] = current_docname
> > return self._parse(rst_text, "<bokeh-gallery>")
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "sphinx-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to [email protected] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > Visit this group at https://groups.google.com/group/sphinx-users.
> > For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.