Autodoc can't find module

1,392 views
Skip to first unread message

Nikolaus Rath

unread,
Oct 16, 2010, 3:21:35 PM10/16/10
to sphin...@googlegroups.com
Hello,

Can someone tell me what I'm doing wrong?

$ ./setup.py build_sphinx -E
running build_sphinx
Running Sphinx v1.0.4
[..]
/home/nikratio/projekte/python-llfuse/rst/llfuse.rst:9: (WARNING/2) autodoc can't import/find method 'llfuse.llfuse.main', it reported error: "llfuse", please check your spelling and sys.path
[..]

$ cat rst/llfuse.rst

====================
`llfuse` functions
====================


.. py:module:: llfuse

.. automethod:: llfuse.main

$ python -c 'import llfuse; print llfuse.main.__doc__'
Run FUSE main loop

Best,

-Nikolaus

--
»Time flies like an arrow, fruit flies like a Banana.«

PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C

Nikolaus Rath

unread,
Oct 17, 2010, 2:14:45 PM10/17/10
to sphin...@googlegroups.com
Nikolaus Rath <Niko...@rath.org> writes:
[ Problems with autodoc ]

I did a bit more testing, and it seems that there really are some issues
with the automodule directive.

Consider the attached small sample module bla.py.

bla.py

Georg Brandl

unread,
Oct 17, 2010, 2:24:36 PM10/17/10
to sphin...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> If we add it to PYTHONPART and run sphinx with the an index.rst
> file that just contains:
>
> .. automodule:: bla
> :members:
>
> then everything works as expected. However, if we change to
>
> .. automethod:: bla.mymethod
>
> then we get the following error:
>
> index.rst:1: (WARNING/2) don't know which module to import for autodocumenting u'bla.mymethod' (try placing a "module" or "currentmodule" directive in the document, or giving an explicit module name)
>
> yet if we follow the suggestion and try
>
> .. currentmodule:: bla
> .. automethod:: bla.mymethod
>
> things do not get any better:
>
> index.rst:2: (WARNING/2) autodoc can't import/find method 'bla.bla.mymethod', it reported error: "bla", please check your spelling and sys.path
>
> And even the last alternative,
>
> .. currentmodule:: bla
> .. automethod:: mymethod
>
> fails miserably:
>
> index.rst:2: (WARNING/2) don't know which module to import for autodocumenting u'mymethod' (try placing a "module" or "currentmodule" directive in the document, or giving an explicit module name)
>
>
>
> Is this a bug in automethod or am I just totally failing to understand
> the way to use it?

I wouldn't talk about total failure, but the auto*method* directive needs a
class name. What you want is auto*function*.

cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)

iEYEARECAAYFAky7P2QACgkQN9GcIYhpnLD89ACfSh38hXprGuFKc0j40MYnV92R
XnkAoJnZhfTPKSlHfdEfWtNq1susLDJk
=fK7h
-----END PGP SIGNATURE-----

Nikolaus Rath

unread,
Oct 17, 2010, 3:55:38 PM10/17/10
to sphin...@googlegroups.com
Georg Brandl <ge...@python.org> writes:
>> Is this a bug in automethod or am I just totally failing to understand
>> the way to use it?
>
> I wouldn't talk about total failure, but the auto*method* directive needs a
> class name. What you want is auto*function*.


Arg. Of course. Thanks!

Reply all
Reply to author
Forward
0 new messages