Hi David,
Better keep things on the list, as it might help others.
On 7/30/2015 18:34, David Aldrich wrote:
>> I think you need to add the following at the top of your file.
>>
>> .. module:: main
> Hi Werner
> Thanks. That works better. But I do run into problems if the source file
> is importing modules from unusual paths. I am working with Kivy and see:
> C:\PythonDocs\index.rst:19: WARNING: autodoc: failed to import class
> 'CSchematic' from module 'main'; the following exception ...
> Traceback (most recent call last):
> File
> "C:\Kivy-1.9.0-py3.4-win32-x64\Python34\lib\site-packages\sphinx\ext\autodoc.py",
> line 385, in import_object
> __import__(self.modname)
> File "C:\SVNProj\Raggio\trunk\hostconsole\gui\main.py", line 56, in
> <module>
> import mygraph
> File "C:\SVNProj\Raggio\trunk\hostconsole\gui\mygraph.py", line 23,
> in <module>
> from kivy.garden.graph import Plot, Graph, MeshLinePlot,
> MeshStemPlot, LinePlot
> File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
> File "<frozen importlib._bootstrap>", line 2226, in
> _find_and_load_unlocked
> File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
> File "<frozen importlib._bootstrap>", line 1163, in
> _load_backward_compatible
> KeyError: 'kivy.garden.graph'
> I wonder if I can just get Sphinx to ignore 'kivy.garden.graph'. Do you
> have a suggestion for how best to fix this please?
Sorry not sure what is the best way to do this.
Is 'kivy' installed on your system? If not I would install it, as it
should be there as Sphinx does an 'import' of your module, but by
default it will not document it - see "inherited-members" in the
autoclass directive -
http://sphinx-doc.org/ext/autodoc.html?highlight=autoclass#directive-autoclass
Also I am bit confused as you get a KeyError, so really not sure what
causes this.
Werner