shashaDenovo
shashaDenovo

Reputation: 1638

sphinx-build: error: unrecognized arguments: -b html build/doctrees source build/html

I am using Sphinx for documenting my project. when i am running make html i am getting this error.

I have installed Sphinx v1.1.2 . There might be some error in some of .rst, files but This error message is unhelpful since i do not know which file to check as i have more than 100 .rst files. So it is difficult to check files one by one.

Is there any way to solve this error or at-least to find out which file is erroneous?

Thanks in advance.

Upvotes: 2

Views: 3120

Answers (2)

mlt
mlt

Reputation: 1669

If you are using sphinx-apidoc and your package uses setuptools with setup.py in the same folder, make sure you hide away setup() call into if 'main' == __name__: construct.

Upvotes: 1

Kashyap
Kashyap

Reputation: 17546

Check the module that was being processed just before this error. That module is probably missing if __name__ == '__main__' check.

The issue here is that:

  • sphinx-apidoc (or whatever you used to generate your rsts) probably put automodule/autoclass/... in your rst.
  • sphinx uses autodoc extension to fetch doc strings from teh .py files when it encounters the autoXXX directive in rst file.
  • autodoc import the .py module to extract the doc strings from it.
  • on import if a module by default assumes it's an executable only (i.e. doesn't have the __main__ check) the you'll get the error.

What makes this is a pain in the a$$ error is that most developers would use sys.argv[0] and sys.argv[0:] in the error message displayed on wrong args, causing a completely unappropriate error message being printed in this case.

Upvotes: 3

Related Questions