日々、勉強。

自宅の開発でトラブルになったことの解決策をメモっていきます。

Did you change the syntax from 2.x to 3.x? : Sphinx

Configuration error:
There is a syntax error in your configuration file: bad input (conf.py, line 15)
Did you change the syntax from 2.x to 3.x?
(hl-ml-env) saegusahirokazunoiMac:Hello-World-ML saigusahirokazu$ sphinx-build -a ./docs ./publish
Running Sphinx v1.7.5

 

Sphinx を実行した時に、このErrorが出て大分苦戦したので、メモを残す。

実際に行ったのは、conf.pyの下記の部分のコメントを外しただけだったにも関わらずErrorgがでた。

 

File : conf.py

-- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#

 import os   # ← コメントを外したところ
 import sys  # ← コメントを外したところ
 sys.path.insert(0, '/Users/guest/Documents/Workspace/git/my_project/src') # パスの書き換え

 

結論から言うと、import osの前に、空欄が入っていたのがErrorになっていたらしい。

よって、以下のように直す。

 

File : conf.py

-- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#

import os   # ← import osの前の空欄を削除
import sys  # ← import sysの前の空欄を削除
sys.path.insert(0, '/Users/guest/Documents/Workspace/git/my_project/src') # sys.path.insertの前の空欄を削除

 

自分の場合は、これだけで上手く行った。