From edbbd63bd3f957c1482f7390de90cce07a448a3a Mon Sep 17 00:00:00 2001 From: "Takuya. O" <16006732+stdll00@users.noreply.github.com> Date: Wed, 7 Feb 2024 22:39:20 +0900 Subject: [PATCH] Fix: ipykernel_launcher, delete absolute sys.path[0] (#1206) --- ipykernel_launcher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ipykernel_launcher.py b/ipykernel_launcher.py index 49aa2651a..0739d4b1a 100644 --- a/ipykernel_launcher.py +++ b/ipykernel_launcher.py @@ -5,11 +5,12 @@ """ import sys +from pathlib import Path if __name__ == "__main__": # Remove the CWD from sys.path while we load stuff. # This is added back by InteractiveShellApp.init_path() - if sys.path[0] == "": + if sys.path[0] == "" or Path(sys.path[0]) == Path.cwd(): del sys.path[0] from ipykernel import kernelapp as app