alex-rudakov / sphinx-argparse

Sphinx extension that automatically document argparse commands and options
MIT License
49 stars 40 forks source link

failing gracefully in case the given module could not be imported #39

Closed gabrielfalcao closed 7 years ago

gabrielfalcao commented 8 years ago

Hello there! First of all, many thanks for creating this great library.

I used it in my project but pointed the :ref: to an invalid python module of mine (it was missing a __init__.py), then sphinx-argparse raised an exception whose message was not helpful at all.

This patch provides a much more descriptive output, for example:

/home/..redacted../docs/source/cli.rst:33: ERROR: Failed to import "MyPythonProject.console.parsers.command1" from "parser": No module named parsers.command1
/home/..redacted../docs/source/cli.rst:33: ERROR: Failed to import "MyPythonProject.console.parsers.command2" from "parser": No module named parsers.command2
gabrielfalcao commented 8 years ago

Please let me know what adjustments you would like me to do in the code for you to accept this PR

dpryan79 commented 7 years ago

I've implemented this in the develop branch so it should be in the next release. Thanks!

gabrielfalcao commented 7 years ago

Thank you!