WARNING: autodoc: failed to import module 'OCR'; the following exception was raised: No module named 'OCR'

895 views
Skip to first unread message

Dirk Schiller

unread,
Aug 3, 2019, 4:18:09 AM8/3/19
to sphinx-users
I have Problems to let 'autodoc' read a Python File ( OCR.py ). I have no Idea what the Problem could be. Maybe someone can help. Thank you a lot for reading and maybe advising!

Folder Structure:

AutoQA
  Docu
    _build
    QALibs
      Automation.rst
    conf.py
    index.rst
  QALibs
    Automation
      Automation.py
      OCR.py

******************************************************************

Automation.rst:

Automation
==========

.. automodule:: Automation
    :members:
    :undoc-members:
    :inherited-members:

.. automodule:: OCR
    :members:
    :undoc-members:
    :inherited-members:

******************************************************************

conf.py:

import sys, os
sys.path.append(os.path.abspath('../QALibs'))

project = 'AutoQA'

extensions = [
    'sphinx.ext.autodoc'
]

html_theme = "sphinx_rtd_theme"

******************************************************************

index.rst:

.. toctree::
    :maxdepth: 4
    :caption: QALibs Documentation

    QALibs/Automation

******************************************************************

OCR.py ( Excerpt ):

'''
Module **OCR** provides Tools for Screen Reading.
Uses `Tesseract OCR`_.

'''
import pytesseract, pyautogui, sys, cv2
sys.path.append('../..')
from QALibs.Automation import Automation
from QALibs.Log import Log


@staticmethod
def findText(text, getRightPosition=False):
...

******************************************************************

Sphinx 'make html' Output after 'make clean':

Removing everything under '_build'...
Running Sphinx v2.1.2
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 23 source files that are out of date
updating environment: 23 added, 0 changed, 0 removed
reading sources... [100%] py-modindex
WARNING: autodoc: failed to import module 'OCR'; the following exception was raised:
No module named 'OCR'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] py-modindex
generating indices... genindex py-modindex
writing additional pages... searchc:\users\dschiller.iet\appdata\local\programs\python\python37-32\lib\site-packages\sphinx_rtd_theme\search.html:20: RemovedInSphinx30Warning: To modify script_files in the theme is deprecated. Please insert a <script> tag directly in your theme instead.
  {{ super() }}

copying images... [100%] AutoQA\../Images/AutoQA/Initializer.png
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 9 warnings.

The HTML pages are in _build\html.


Reply all
Reply to author
Forward
0 new messages