From fe042603646f800f3a2f3516266219448260d5e6 2021-09-22 11:03:03 From: Mithil Poojary Date: 2021-09-22 11:03:03 Subject: [PATCH] Adapt to all sorts of drive names Earlier implementation assumed the drive name to be C and ignored the possibility of it being different. Drive names could also be greater than 1 in length. This possibility is also considered now. --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index ef83ce8..7d5b897 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -924,7 +924,9 @@ class InteractiveShell(SingletonConfigurable): # In Cygwin paths like "c:\..." and '\cygdrive\c\...' are possible if str(p_venv).startswith("\\cygdrive"): - p_venv = "C:" / Path(str(p_venv)[11:]) + p_venv = Path(str(p_venv)) + 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.