From 048c26fdce095f93cbd717b5cada85f9a6f5a42e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 17 Oct 2014 12:50:08 +0530 Subject: [PATCH] calibre-debug: support execution of a directory containing a __main__.py file --- src/calibre/debug.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/debug.py b/src/calibre/debug.py index 7814af5d9d..b8f89c7e11 100644 --- a/src/calibre/debug.py +++ b/src/calibre/debug.py @@ -278,6 +278,9 @@ def main(args=sys.argv): inspect_mobi(path) else: print ('Cannot dump unknown filetype: %s' % path) + elif len(args) >= 2 and os.path.exists(os.path.join(args[1], '__main__.py')): + sys.path.insert(0, args[1]) + run_script(os.path.join(args[1], '__main__.py'), args[2:]) else: from calibre import ipython ipython()