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

'Values' object has no attribute 'pep_references' missing with 1.7.0b1 #4493

Closed
shirou opened this Issue Jan 25, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@shirou
Copy link
Contributor

commented Jan 25, 2018

Subject: 'Values' object has no attribute 'pep_references' in 1.7.0b1

Problem

When I sphinx-build 1.7.0b1 with old environment, build stopped which AttributeError

Perhaps, this is related to recommonmark.

Procedure to reproduce the problem

make html

Error logs / results

At first, I got this smartquotes_locales error.

# Sphinx version: 1.7.0b1
# Python version: 3.6.3 (CPython)
# Docutils version: 0.14 
# Jinja2 version: 2.10
# Last messages:
#   building [mo]: targets for 0 po files that are out of date
#   
#   building [html]: targets for 4 source files that are out of date
#   
#   updating environment:
#   
#   1 added, 2 changed, 0 removed
#   
#   reading sources... [ 33%] foo/bar
#   
# Loaded extensions:
#   alabaster (0.7.10) from /home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/alabaster/__init__.py
#   sphinx.ext.autodoc (1.7.0b1) from /home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/ext/autodoc/__init__.py
#   sphinx.ext.todo (1.7.0b1) from /home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/ext/todo.py
#   sphinx.ext.mathjax (1.7.0b1) from /home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/ext/mathjax.py
#   sphinx.ext.viewcode (1.7.0b1) from /home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/ext/viewcode.py
Traceback (most recent call last):
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/cmdline.py", line 287, in main
    app.build(args.force_all, filenames)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/application.py", line 331, in build
    self.builder.build_update()
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 330, in build_update
    'out of date' % len(to_build))
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 343, in build
    updated_docnames = set(self.env.update(self.config, self.srcdir, self.doctreedir))
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 568, in update
    self._read_serial(docnames, self.app)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 587, in _read_serial
    self.read_doc(docname, app)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 662, in read_doc
    doctree = read_doc(self.app, self, self.doc2path(docname))
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/io.py", line 294, in read_doc
    pub.publish()
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/docutils/core.py", line 218, in publish
    self.apply_transforms()
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/docutils/core.py", line 199, in apply_transforms
    self.document.transformer.apply_transforms()
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/transforms/__init__.py", line 95, in apply_transforms
    Transformer.apply_transforms(self)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
    transform.apply(**kwargs)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/transforms/__init__.py", line 350, in apply
    SmartQuotes.apply(self)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/docutils/transforms/universal.py", line 263, in apply
    lc_smartquotes = self.document.settings.smartquotes_locales
AttributeError: 'Values' object has no attribute 'smartquotes_locales'

But after retry, I got new error.

# Sphinx version: 1.7.0b1
# Python version: 3.6.3 (CPython)
# Docutils version: 0.14 
# Jinja2 version: 2.10
# Last messages:
#   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%] a
#   
# Loaded extensions:
#   alabaster (0.7.10) from /home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/alabaster/__init__.py
#   sphinx.ext.autodoc (1.7.0b1) from /home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/ext/autodoc/__init__.py
#   sphinx.ext.todo (1.7.0b1) from /home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/ext/todo.py
#   sphinx.ext.mathjax (1.7.0b1) from /home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/ext/mathjax.py
#   sphinx.ext.viewcode (1.7.0b1) from /home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/ext/viewcode.py
Traceback (most recent call last):
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/cmdline.py", line 287, in main
    app.build(args.force_all, filenames)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/application.py", line 331, in build
    self.builder.build_update()
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 330, in build_update
    'out of date' % len(to_build))
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 343, in build
    updated_docnames = set(self.env.update(self.config, self.srcdir, self.doctreedir))
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 568, in update
    self._read_serial(docnames, self.app)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 587, in _read_serial
    self.read_doc(docname, app)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 662, in read_doc
    doctree = read_doc(self.app, self, self.doc2path(docname))
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/io.py", line 294, in read_doc
    pub.publish()
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/docutils/core.py", line 218, in publish
    self.apply_transforms()
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/docutils/core.py", line 199, in apply_transforms
    self.document.transformer.apply_transforms()
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/sphinx/transforms/__init__.py", line 95, in apply_transforms
    Transformer.apply_transforms(self)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
    transform.apply(**kwargs)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/recommonmark/transform.py", line 326, in apply
    self.traverse(self.document)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/recommonmark/transform.py", line 298, in traverse
    self.traverse(child)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/recommonmark/transform.py", line 288, in traverse
    newnode = self.find_replace(c)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/recommonmark/transform.py", line 270, in find_replace
    newnode = self.auto_code_block(node)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/recommonmark/transform.py", line 229, in auto_code_block
    self.current_level)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/recommonmark/states.py", line 50, in reset
    self.memo.inliner.init_customizations(document.settings)
  File "/home/shirou/Works/VEnvs/sphinx/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 605, in init_customizations
    if settings.pep_references:
AttributeError: 'Values' object has no attribute 'pep_references'

Expected results

build success.

Reproducible project / your project

https://gist.github.com/shirou/252693be49ad642ef65a1f8371c186b6

json language settings produce this error.

Environment info

  • OS: Linux Ubuntu 16.04
  • Python version: 3.6.3
  • Sphinx version: sphinx-build 1.7.0b1

some of conf.py.

from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify

extensions = ['sphinx.ext.autodoc',
              'sphinx.ext.todo',
              'sphinx.ext.mathjax',
              'sphinx.ext.viewcode',
]

language = None

@tk0miya tk0miya added this to the 1.7 milestone Jan 25, 2018

@tk0miya tk0miya self-assigned this Jan 25, 2018

@shirou

This comment has been minimized.

Copy link
Contributor Author

commented Jan 26, 2018

Sorry, after first error, the error was changed.

    if settings.pep_references:
AttributeError: 'Values' object has no attribute 'pep_references'

to reproduce
https://gist.github.com/shirou/252693be49ad642ef65a1f8371c186b6

It may be an recommonmark issue.

@shirou shirou changed the title `smartquotes_locales` missing with 1.7.0b1 'Values' object has no attribute 'pep_references' missing with 1.7.0b1 Jan 26, 2018

@jfbu

This comment has been minimized.

Copy link
Contributor

commented Jan 26, 2018

Commenting out from conf.py's setup(app)

app.add_transform(AutoStructify)

allows your minimal example to compile.

@shirou

This comment has been minimized.

Copy link
Contributor Author

commented Jan 26, 2018

Wehn I remove AutoStructify, success to build and code-highting also works.

I wonder add_transform(AutoStructify) is not required although it is in the document. But anyway, it works for me and it is recommonmark issue and not related to Sphinx itself directly.

Thank you!

@shirou shirou closed this Jan 26, 2018

@tk0miya tk0miya reopened this Jan 27, 2018

@tk0miya

This comment has been minimized.

Copy link
Member

commented Jan 27, 2018

Reopened for investigation.
I'd like to know where the error comes from. I think the change is not intended on 1.7.

tk0miya added a commit to tk0miya/sphinx that referenced this issue Jan 28, 2018

tk0miya added a commit that referenced this issue Jan 29, 2018

Merge pull request #4512 from tk0miya/4493_recommonmark_raises_Attrib…
…uteError

Fix #4493: recommonmark raises AttributeError if AutoStructify enabled
@tk0miya

This comment has been minimized.

Copy link
Member

commented Jan 29, 2018

Fixed by #4512.
Thank you for reporting

@tk0miya tk0miya closed this Jan 29, 2018

@shirou

This comment has been minimized.

Copy link
Contributor Author

commented Feb 1, 2018

I confirmed this problem is not occured on 1.7.0b2. Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.