Skip to content

Commit 0efd2df

Browse files
committed
solving no header in additional data, causing error
1 parent c81d80d commit 0efd2df

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

jupyter-cpp-kernel/kernel.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,27 +216,24 @@ def _filter_magics(self, code):
216216

217217
# Supported by using Jupyter
218218
def _find_local_header(self):
219-
220-
import sys
221-
from os.path import abspath, dirname, exists, join, split
222-
223-
path = abspath(dirname(__file__))
219+
path = path.abspath(path.dirname(__file__))
224220
starting_points = [path]
225221
if not path.startswith(sys.prefix):
226222
starting_points.append(sys.prefix)
227223
for path in starting_points:
228224
while path != '/':
229-
share_jupyterhub = join(path, 'share', 'cpp_header')
230-
if all(exists(join(share_jupyterhub, f)) for f in ['check_cpp.hpp']):
225+
share_jupyterhub = path.join(path, 'share', 'cpp_header')
226+
if all(path.exists(path.join(share_jupyterhub, f)) for f in ['check_cpp.hpp']):
231227
return share_jupyterhub
232-
path, _ = split(path)
228+
path, _ = path.split(path)
233229
# didn't find it, give up
234230
return ''
235231

236232
def _support_external_header(self, code):
237233
DATA_FILES_PATH = self._find_local_header()
234+
code = ""
238235
for file in os.listdir(DATA_FILES_PATH):
239-
path_to_header = DATA_FILES_PATH + "/" + file
236+
path_to_header = os.path.join(DATA_FILES_PATH, file)
240237
if os.path.isdir(path_to_header):
241238
pass
242239
elif os.path.isfile(path_to_header):

0 commit comments

Comments
 (0)