Xqt has submitted this change and it was merged.
Change subject: Inline help if base_dir does not contain user-config.py ......................................................................
Inline help if base_dir does not contain user-config.py
Change-Id: Ib05d843f6e07a94e92b65a56f8495dca5dad46ea --- M pywikibot/config2.py 1 file changed, 7 insertions(+), 2 deletions(-)
Approvals: Xqt: Looks good to me, approved
diff --git a/pywikibot/config2.py b/pywikibot/config2.py index 8fec8c0..6c2687c 100644 --- a/pywikibot/config2.py +++ b/pywikibot/config2.py @@ -139,8 +139,13 @@ raise RuntimeError("Directory '%(base_dir)s' does not exist." % locals()) if not os.path.exists(os.path.join(base_dir, "user-config.py")): - raise RuntimeError("No user-config.py found in directory '%(base_dir)s'." - % locals()) + exc_text = "No user-config.py found in directory '%(base_dir)s'.\n" % locals() + exc_text += " Please check that user-config.py is stored in the correct location.\n" + exc_text += " Directory where user-config.py is searched is determined as follows:\n\n" + exc_text += " " + _get_base_dir.__doc__ + + raise RuntimeError(exc_text) + return base_dir
_base_dir = _get_base_dir()
pywikibot-commits@lists.wikimedia.org