From e2eed912b2b5d8e26936b383fc033c5771500638 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 24 Nov 2014 09:17:34 +0530 Subject: [PATCH] Do not modify sys.path when using calibre-debug to run files in the calibre source code, since calibre always uses absolute imports anyway --- src/calibre/debug.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/debug.py b/src/calibre/debug.py index 116fd73187..6f49799888 100644 --- a/src/calibre/debug.py +++ b/src/calibre/debug.py @@ -193,8 +193,9 @@ def run_script(path, args): sys.argv = [path] + args ef = os.path.abspath(path) - base = os.path.dirname(ef) - sys.path.insert(0, base) + if '/src/calibre/' not in ef.replace(os.pathsep, '/'): + base = os.path.dirname(ef) + sys.path.insert(0, base) g = globals() g['__name__'] = '__main__' g['__file__'] = ef