Skip to content

Commit d69ec20

Browse files
committed
Revert "solving no header in additional data, causing error"
This reverts commit 0efd2df.
1 parent 092910d commit d69ec20

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

jupyter-cpp-kernel/kernel.py

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

217217
# Supported by using Jupyter
218218
def _find_local_header(self):
219-
path = path.abspath(path.dirname(__file__))
219+
220+
import sys
221+
from os.path import abspath, dirname, exists, join, split
222+
223+
path = abspath(dirname(__file__))
220224
starting_points = [path]
221225
if not path.startswith(sys.prefix):
222226
starting_points.append(sys.prefix)
223227
for path in starting_points:
224228
while path != '/':
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']):
229+
share_jupyterhub = join(path, 'share', 'cpp_header')
230+
if all(exists(join(share_jupyterhub, f)) for f in ['check_cpp.hpp']):
227231
return share_jupyterhub
228-
path, _ = path.split(path)
232+
path, _ = split(path)
229233
# didn't find it, give up
230234
return ''
231235

232236
def _support_external_header(self, code):
233237
DATA_FILES_PATH = self._find_local_header()
234-
code = ""
235238
for file in os.listdir(DATA_FILES_PATH):
236-
path_to_header = os.path.join(DATA_FILES_PATH, file)
239+
path_to_header = DATA_FILES_PATH + "/" + file
237240
if os.path.isdir(path_to_header):
238241
pass
239242
elif os.path.isfile(path_to_header):

0 commit comments

Comments
 (0)