{"action":"created","issue":{"url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2799","repository_url":"https://api.github.com/repos/sphinx-doc/sphinx","labels_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2799/labels{/name}","comments_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2799/comments","events_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2799/events","html_url":"https://github.com/sphinx-doc/sphinx/issues/2799","id":166552451,"number":2799,"title":"Importing sphinx breaks the docutils parser","user":{"login":"brechtm","id":652887,"avatar_url":"https://avatars.githubusercontent.com/u/652887?v=3","gravatar_id":"","url":"https://api.github.com/users/brechtm","html_url":"https://github.com/brechtm","followers_url":"https://api.github.com/users/brechtm/followers","following_url":"https://api.github.com/users/brechtm/following{/other_user}","gists_url":"https://api.github.com/users/brechtm/gists{/gist_id}","starred_url":"https://api.github.com/users/brechtm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brechtm/subscriptions","organizations_url":"https://api.github.com/users/brechtm/orgs","repos_url":"https://api.github.com/users/brechtm/repos","events_url":"https://api.github.com/users/brechtm/events{/privacy}","received_events_url":"https://api.github.com/users/brechtm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-07-20T10:46:38Z","updated_at":"2016-07-28T02:45:30Z","closed_at":"2016-07-28T02:23:43Z","body":"`test.rst`:\r\n\r\n```\r\nA PEP reference :PEP:`287`.\r\n```\r\n\r\n`test.py`:\r\n\r\n```\r\nfrom docutils.core import publish_doctree\r\nfrom docutils.io import FileInput\r\n\r\nfrom sphinx.application import Sphinx  # breaks docutils parsing\r\n\r\nwith open('test.rst') as file:\r\n    doctree = publish_doctree(file, source_class=FileInput)\r\n\r\n```\r\n\r\nRunning `test.py` fails with:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/statemachine.py\", line 307, in next_line\r\n    self.line = self.input_lines[self.line_offset]\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/statemachine.py\", line 1152, in __getitem__\r\n    return self.data[i]\r\nIndexError: list index out of range\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/statemachine.py\", line 230, in run\r\n    self.next_line()\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/statemachine.py\", line 310, in next_line\r\n    raise EOFError\r\nEOFError\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"test.py\", line 8, in <module>\r\n    doctree = publish_doctree(file, source_class=FileInput)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/core.py\", line 479, in publish_doctree\r\n    output = pub.publish(enable_exit_status=enable_exit_status)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/core.py\", line 217, in publish\r\n    self.settings)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/readers/__init__.py\", line 72, in read\r\n    self.parse()\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/readers/__init__.py\", line 78, in parse\r\n    self.parser.parse(self.input, document)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/parsers/rst/__init__.py\", line 172, in parse\r\n    self.statemachine.run(inputlines, document, inliner=self.inliner)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/parsers/rst/states.py\", line 170, in run\r\n    input_source=document['source'])\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/statemachine.py\", line 245, in run\r\n    result = state.eof(context)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/parsers/rst/states.py\", line 2669, in eof\r\n    self.blank(None, context, None)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/parsers/rst/states.py\", line 2661, in blank\r\n    context, self.state_machine.abs_line_number() - 1)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/parsers/rst/states.py\", line 418, in paragraph\r\n    textnodes, messages = self.inline_text(text, lineno)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/parsers/rst/states.py\", line 427, in inline_text\r\n    return self.inliner.parse(text, lineno, self.memo, self.parent)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/parsers/rst/states.py\", line 513, in parse\r\n    lineno)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/parsers/rst/states.py\", line 776, in interpreted_or_phrase_ref\r\n    lineno)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/docutils/parsers/rst/states.py\", line 856, in interpreted\r\n    nodes, messages2 = role_fn(role, rawsource, text, lineno, self)\r\n  File \"/Users/brechtm/.pyenv/versions/rinoh-py35/lib/python3.5/site-packages/sphinx/roles.py\", line 179, in indexmarkup_role\r\n    env = inliner.document.settings.env\r\nAttributeError: 'Values' object has no attribute 'env'\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/comments/235785802","html_url":"https://github.com/sphinx-doc/sphinx/issues/2799#issuecomment-235785802","issue_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2799","id":235785802,"user":{"login":"tk0miya","id":748828,"avatar_url":"https://avatars.githubusercontent.com/u/748828?v=3","gravatar_id":"","url":"https://api.github.com/users/tk0miya","html_url":"https://github.com/tk0miya","followers_url":"https://api.github.com/users/tk0miya/followers","following_url":"https://api.github.com/users/tk0miya/following{/other_user}","gists_url":"https://api.github.com/users/tk0miya/gists{/gist_id}","starred_url":"https://api.github.com/users/tk0miya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tk0miya/subscriptions","organizations_url":"https://api.github.com/users/tk0miya/orgs","repos_url":"https://api.github.com/users/tk0miya/repos","events_url":"https://api.github.com/users/tk0miya/events{/privacy}","received_events_url":"https://api.github.com/users/tk0miya/received_events","type":"User","site_admin":false},"created_at":"2016-07-28T02:45:30Z","updated_at":"2016-07-28T02:45:30Z","body":"I fixed this at 84baf05.\r\nIt installs roles and directives on boostrap of the application.\r\n\r\nIt still overrides `pep` and `rfc` roles after application ran. I know this does not resolve completely this problem. But it might help you."}}
{"actor":{"display_login":"tk0miya"}}