Reputation: 1638
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
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
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:
autodoc
extension to fetch doc strings from teh .py files when it encounters the autoXXX directive in rst file.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