-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pipenv shell not changing directory on Windows remote share #4438
Comments
I made a quick and dirty hack to def fork(self, venv, cwd, args):
# FIXME: This isn't necessarily the correct prompt. We should read the
# actual prompt by peeking into the activation script.
name = os.path.basename(venv)
os.environ["VIRTUAL_ENV"] = str(venv)
if "PROMPT" in os.environ:
os.environ["PROMPT"] = "({0}) {1}".format(name, os.environ["PROMPT"])
if "PS1" in os.environ:
os.environ["PS1"] = "({0}) {1}".format(name, os.environ["PS1"])
with self.inject_path(venv):
if cwd.startswith("\\\\"):
import win32net
drive_letters = {}
resume = 0
while True:
(_drives, total, resume) = win32net.NetUseEnum(None, 0, resume)
for drive in _drives:
if drive["local"]:
drive_letters[drive["remote"]] = drive["local"]
if not resume:
break
remote_share, path = os.path.splitdrive(cwd)
new_path = os.path.join(drive_letters[remote_share], path)
os.chdir(new_path)
else:
os.chdir(cwd)
_handover(self.cmd, self.args + list(args)) |
The patch LGTM, would you like to send a PR? @krzesu0 |
Same problem on macos,how can i fix it? |
I see this issue as well with Windows share drives But this is because CMD.EXE doesn't like UNC paths pipenv is launching CMD.EXE as default regardless of whether you are currently using it or not. I always use Powershell and pipenv is launching CMD.EXE inside powershell.. Is there a way to tell pipenv to use powershell as the subshell instead of cmd.exe This would get around this annoying issue of remote shares as well |
This still does not work for me, neither in the normal windows shell nor in the Powershell (nor in git bash). Any news on this, or ideas how to circumvent what is actually a problem of the windows shell? I also found this issue #2295 with the associated pull request from 5 years ago which says it should solve the issue, but that does not seem to be true? |
Issue description
Using
pipenv shell
on windows remote share results in new shell spawned not inside the desired folder but insideC:\Windows
due to Windows not complying with its own UNC.Expected result
instead of:
Actual result
Steps to replicate
Create new environment on windows remote share with drive letter.
Run
pipenv shell
.I don't think that
pipenv --support
is needed here, but why not. 🤷♀️$ pipenv --support
Pipenv version:
'2020.8.13'
Pipenv location:
'f:\\python3.8.2\\lib\\site-packages\\pipenv'
Python location:
'f:\\python3.8.2\\python.exe'
Python installations found:
3.8.2
:F:\Python3.8.2\python.exe
3.6.8
:F:\Python3.6.2\python.exe
PEP 508 Information:
System environment variables:
ALLUSERSPROFILE
AMDRMPATH
APPDATA
COMMONPROGRAMFILES
COMMONPROGRAMFILES(X86)
COMMONPROGRAMW6432
COMPUTERNAME
COMSPEC
CUDA_PATH
CUDA_PATH_V10_2
DRIVERDATA
FLASK_APP
FLASK_ENV
FPS_BROWSER_APP_PROFILE_STRING
FPS_BROWSER_USER_PROFILE_STRING
HOMEDRIVE
HOMEPATH
LOCALAPPDATA
LOGONSERVER
NUMBER_OF_PROCESSORS
NVCUDASAMPLES10_2_ROOT
NVCUDASAMPLES_ROOT
NVTOOLSEXT_PATH
OS
PATH
PATHEXT
PIPENV_ACTIVE
PIP_DISABLE_PIP_VERSION_CHECK
PIP_PYTHON_PATH
PROCESSOR_ARCHITECTURE
PROCESSOR_IDENTIFIER
PROCESSOR_LEVEL
PROCESSOR_REVISION
PROGRAMDATA
PROGRAMFILES
PROGRAMFILES(X86)
PROGRAMW6432
PROMPT
PSMODULEPATH
PUBLIC
PYTHONDONTWRITEBYTECODE
SESSIONNAME
SYSTEMDRIVE
SYSTEMROOT
TEMP
TMP
USERDOMAIN
USERDOMAIN_ROAMINGPROFILE
USERNAME
USERPROFILE
VBOX_MSI_INSTALL_PATH
VIRTUAL_ENV
WINDIR
PIP_SHIMS_BASE_MODULE
PYTHONFINDER_IGNORE_UNSUPPORTED
PipenvÔÇôspecific environment variables:
PIPENV_ACTIVE
:1
DebugÔÇôspecific environment variables:
PATH
:C:\Users\Przemek\.virtualenvs\urlshortener-J1GJALsb\Scripts;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;F:\Putty\;F:\nodejs\;C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.5.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;F:\Python3.8.2\Scripts\;F:\Python3.8.2\;C:\Users\Przemek\AppData\Local\Programs\Python\Launcher\;C:\Users\Przemek\AppData\Local\Microsoft\WindowsApps;F:\Microsoft VS Code\bin;C:\Users\Przemek\AppData\Roaming\npm;F:\libsndfile\bin\;F:\ffmpeg\;
VIRTUAL_ENV
:C:\Users\Przemek\.virtualenvs\urlshortener-J1GJALsb
Contents of
Pipfile
('\\10.154.201.11\all\temp\urlshortener\Pipfile'):Contents of
Pipfile.lock
('\\10.154.201.11\all\temp\urlshortener\Pipfile.lock'):The text was updated successfully, but these errors were encountered: