From a9497bfaef021bdc15e1b5de5a6eb09bbe5ceb18 Mon Sep 17 00:00:00 2001 From: Grigori Fursin Date: Tue, 23 Aug 2016 14:34:24 +0100 Subject: [PATCH] fixed problem with --help or --get_api from kernel --- CHANGES.txt | 1 + ck/kernel.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 69b5f73401..9d66308be8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,7 @@ * V1.7.4dev * extended run_and_get_stdout kernel function * fixed problem in run_and_get_stdout (ValueError: I/O operation on closed file) + * fixed problem with --help or --get_api from kernel * V1.7.3 * fixed rare bug when 'return' is non-integer in remote CK access (such as during crowd-tuning and crowd-testing) diff --git a/ck/kernel.py b/ck/kernel.py index f7c852664b..e5aabbcb9d 100644 --- a/ck/kernel.py +++ b/ck/kernel.py @@ -2041,7 +2041,7 @@ def init(i): p=py break elif px!='': - work['env_root']=px + work['env_root']=px if p=='': return {'return':1, 'error':'Internal CK error (can\'t find default repo) - please report to authors'} @@ -3265,7 +3265,6 @@ def get_api(i): } """ - p=i.get('path','') f=i.get('func','') o=i['out'] @@ -3282,7 +3281,11 @@ def get_api(i): p=rx['path'] if p=='': - p=os.path.join(work['env_root'], cfg['file_kernel_py']) + p1=os.path.dirname(os.path.dirname(work['dir_default_repo'])) + p=os.path.join(p1, cfg['file_kernel_py']) + + if not os.path.isfile(p): + return {'return':1, 'error':'kernel not found in '+p} else: p=os.path.join(p, 'module.py')