Cannot run sphinx from pycharm

Answered

I am using PyCharm 2.0.1 on a Mac OS X 10.6. In the project I have configured a virtual environment with Python 3.2:

When I run a 'sphinx task in docs' (my task to generate the documentation) I get the following:

--------

/Users/XXX/envs/YYY/bin/python /Applications/PyCharm.app/helpers/rest_runners/sphinx_runner.py -bhtml /Users/XXX/Documents/code/YYY/docs /Users/XXX/Documents/code/YYY/docs/_build/html
Traceback (most recent call last):
  File "/Applications/PyCharm.app/helpers/rest_runners/sphinx_runner.py", line 5, in <module>
    from sphinx import cmdline
  File "/Users/XXX/envs/YYY/lib/python3.2/site-packages/sphinx/cmdline.py", line 18, in <module>
    from docutils.utils import SystemMessage
  File "/Applications/PyCharm.app/helpers/docutils/__init__.py", line 63, in <module>
    class ApplicationError(StandardError): pass
NameError: name 'StandardError' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/PyCharm.app/helpers/rest_runners/sphinx_runner.py", line 7, in <module>
    raise NameError("Cannot find sphinx in selected interpreter.")
NameError: Cannot find sphinx in selected interpreter.

Process finished with exit code 1


--------------

The error is because /Applications/PyCharm.app/helpers/docutils/ is not Python 3 compatible. My question is why you need to call PyCharm's docutils module at all instead of using the one in my python installation? How can I fix this?

Thanks,

Hernan

1
2 comments

Getting the same error on pyenv 3.7.2 on macOS 10.12.6

Any thoughts?

0

Do you get the same error when running this script from the system terminal (outside of PyCharm) using the same interpreter?

0

Please sign in to leave a comment.