.. automodule:: ../this/path/to/my/python/file

oliver dalton avataroliver dalton created an issue

is it possible to use automodule like this? You can read files using literalinclude so why not automodule. thanks getting the following error msg:

~/projects/forge/packages/SphinxDocumentation » make clean && make html                    username@lp-abq01627
rm -rf _build/*
sphinx-build -b html -d _build/doctrees   . _build/html
Making output directory...
Running Sphinx v1.1.3
loading pickled environment... not yet created
loading intersphinx inventory from http://docs.python.org/objects.inv...
building [html]: targets for 4 source files that are out of date
updating environment: 4 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                     
**/Users/username/projects/forge/packages/SphinxDocumentation/importing_external.rst:20: WARNING: invalid signature for automodule (u'../plone/plone/view')
/Users/username/projects/forge/packages/SphinxDocumentation/importing_external.rst:20: WARNING: don't know which module to import for autodocumenting u'../plone/plone/view' (try placing a "module" or "currentmodule" directive in the document, or giving an explicit module name)**
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                      
writing additional files... (0 module code pages) genindex search
copying images... [100%] _static/basic_screenshot.png                                                               
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 2 warnings.

Build finished. The HTML pages are in _build/html.

Comments (4)

  1. Jon Waltman

    I'm afraid not. The automodule directive has to be able to import the module, not just read read the source code. You can modify sys.path in your conf.py to help it find your module.

    Something like this might be useful though. Maybe we could add an option to the automodule directive to specify the load path?

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.