From 6b007c16ddd357a5c189f887f0beace6ac6c01f7 2021-09-22 20:28:14 From: Blazej Michalik <6691643+MrMino@users.noreply.github.com> Date: 2021-09-22 20:28:14 Subject: [PATCH] Merge pull request #13154 from meeseeksmachine/auto-backport-of-pr-13153-on-7.x Backport PR #13153 on branch 7.x (Adapt to all sorts of drive names for cygwin) --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 9a5b465..4ae21e4 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -923,8 +923,9 @@ class InteractiveShell(SingletonConfigurable): paths.append(p.resolve()) # In Cygwin paths like "c:\..." and '\cygdrive\c\...' are possible - if str(p_venv).startswith("\\cygdrive"): - p_venv = "C:" / Path(str(p_venv)[11:]) + if p_venv.parts[1] == "cygdrive": + drive_name = p_venv.parts[2] + p_venv = (drive_name + ":/") / Path(*p_venv.parts[3:]) if any(p_venv == p.parents[1] for p in paths): # Our exe is inside or has access to the virtualenv, don't need to do anything.