Sphinx import module error – method not defined

  mocking, nameerror, python, sphinx

I want to make a sphinx documentation project with my python scripts, which have a custom library, let’s call it myLibrary, several functions, e.g. funct1.
The problem is that when I try to make the html files for my functions, in one script I receive the warning:

"NameError: name ‘funct1′ is not defined.’

I tried following the guidelines using mock() as in this page (http://blog.rtwilson.com/how-to-make-your-sphinx-documentation-compile-with-readthedocs-when-youre-using-numpy-and-scipy/) or by adding in the conf.py file:

autodoc_mock_imports=[‘myLibrary’]

however the problem persists. Perhaps it has to do with the fact that the script begins with:

from myLibrary import *.

Is there a way to workaround this issue?
Thank you.

Source: Python Questions

LEAVE A COMMENT