Do not modify sys.path when using calibre-debug to run files in the calibre source code, since calibre always uses absolute imports anyway

This commit is contained in:
Kovid Goyal 2014-11-24 09:17:34 +05:30
parent c9b2cdfd67
commit e2eed912b2

View File

@ -193,8 +193,9 @@ def run_script(path, args):
sys.argv = [path] + args sys.argv = [path] + args
ef = os.path.abspath(path) ef = os.path.abspath(path)
base = os.path.dirname(ef) if '/src/calibre/' not in ef.replace(os.pathsep, '/'):
sys.path.insert(0, base) base = os.path.dirname(ef)
sys.path.insert(0, base)
g = globals() g = globals()
g['__name__'] = '__main__' g['__name__'] = '__main__'
g['__file__'] = ef g['__file__'] = ef