This is my first time using Sphinx in PyCharm 5.0 with Python 3.5.
When I run sphinx task
in PyCharm I get the following error:
File "C:\Program Files (x86)\JetBrains\PyCharm 5.0\helpers\docutils\__init__.py", line 63, in <module>
class ApplicationError(StandardError): pass
NameError: name 'StandardError' is not defined
On this page I discovered that in Python 3.x StandardError
is now replaced with Exception
. However, when I try to edit the __init__.py
file PyCharm prevents me from saving it.
I also noticed that __init__.py
is based off of docutils version 0.8. This is not intuitive since I installed docutils version 0.12 in my virtualenv. Meaning that version 0.12 is being ignored.
Does anyone know how to fix this?
Update: PyCharm 5.0.2 fixes this, and Sphinx run configurations work under Python 3
Unfortunately the Python code shipped in PyCharm pre-5.0.2 helpers is not Python 3 compatible. The PyCharm issue tracker has a ticket. I once gave a crack at fixing all the small boo-boos, but then ran into some bigger ones.
So instead, just make a Run Configuration that calls:
Script (on Mac): /Users/paul/projects/jetbrains/env35/bin/sphinx-build
Script parameters: -b html -d _build/doctrees . _build/html
...and set the working directory to the place you want the _build
directory.
Edit: Added a link for how to create and edit run/debug configurations in pycharm and a screenshot for windows. Script location is 'Scripts' as opposed to 'bin'.
Creating and Editing Run/Debug Configurations in PyCharm 5.0