Skip to content

Commit 2e6a5ed

Browse files
committed
Do not resolve for non-existent files
1 parent f2daee7 commit 2e6a5ed

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

jupyter_client/provisioning/local_provisioner.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ async def pre_launch(self, **kwargs: Any) -> Dict[str, Any]:
208208

209209
async def launch_kernel(self, cmd: List[str], **kwargs: Any) -> KernelConnectionInfo:
210210
"""Launch a kernel with a command."""
211+
211212
scrubbed_kwargs = LocalProvisioner._scrub_kwargs(kwargs)
212213
self.process = launch_kernel(cmd, **scrubbed_kwargs)
213214
pgid = None
@@ -225,10 +226,10 @@ async def launch_kernel(self, cmd: List[str], **kwargs: Any) -> KernelConnection
225226
async def resolve_path(self, path_str: str) -> Optional[str]:
226227
"""Resolve path to given file."""
227228
path = pathlib.Path(path_str).expanduser()
228-
if path.is_absolute():
229+
if not path.is_absolute() and self.cwd:
230+
path = (pathlib.Path(self.cwd) / path).resolve()
231+
if path.exists():
229232
return path.as_posix()
230-
if self.cwd:
231-
return (pathlib.Path(self.cwd) / path).resolve().as_posix()
232233
return None
233234

234235
@staticmethod

0 commit comments

Comments
 (0)