ignore from sikuli.sikuli when using sphinx-doc

Asked by sddc

Im using sphinx to document my code however I need to included from sikuli.Sikuli import * at the top of each file. When I run make html with sphinx I get these errors. the only way I can get around it is to delete that line, generate the documentation, and then add it back to all the files. I tried adding paths in conf.py file for sphinx to the sphinx install folder but that didn't do anything.

reading sources... [100%] control
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\sphinx-1.1.3-py2.7.egg\sphinx\ext\autodoc.
py", line 321, in import_object
    __import__(self.modname)
  File "C:\Users\gggg\Desktop\DBA\control.sikuli\control.py", line 1,
 in <module>
    from sikuli.Sikuli import *
ImportError: No module named sikuli.Sikuli

C:\Users\gggg\Desktop\DBA\_sphinx_source\control.rst:6: WARNING: autodoc can'
t import/find module 'control', it reported error: "No module named sikuli.Sikul
i", please check your spelling and sys.path

is there anything I can change in sikuli to have sphinx ignore the from sikuli.sikuli statement?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Since your Sphinx seems to run in a C-Python environment (Python27), the import will never work, since the relevant modules are inside sikuli-script.jar (Python cannot import from there).

You have to use Jython to run Sphinx autodoc.

You might use the Sikuli built in Jython:
java -cp path-to-sikuli-script.jar org.python.util.jython ....

BTW: in the latest Sikuli versions
from sikuli import *
is sufficient.

Can you help with this problem?

Provide an answer of your own, or ask sddc for more information if necessary.

To post a message you must log in.