shellingham icon indicating copy to clipboard operation
shellingham copied to clipboard

WinError using pipenv in Pypy

Open Aareon opened this issue 3 years ago • 1 comments

When trying to install any package or execute any pipenv sub-command, pipenv fails with [WinError 6] The handle is invalid

Aareon@DESKTOP-K5VQOE1 MINGW64 /i/StaSH2 (master)
$ pipenv install dearpygui
Traceback (most recent call last):
  File "i:\programs\pypy3.7-v7.3.4-win64\lib-python\3\runpy.py", line 196, in _r
un_module_as_main
    "__main__", mod_spec)
  File "i:\programs\pypy3.7-v7.3.4-win64\lib-python\3\runpy.py", line 85, in _ru
n_code
    exec(code, run_globals)
  File "I:\Programs\pypy3.7-v7.3.4-win64\Scripts\pipenv.exe\__main__.py", line 4
, in <module>
    from pipenv import cli
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\__init__.py", line
 55, in <module>
    from .cli import cli
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\cli\__init__.py",
line 4, in <module>
    from .command import cli    # noqa
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\cli\command.py", l
ine 13, in <module>
    from ..exceptions import PipenvOptionsError
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\exceptions.py", li
ne 14, in <module>
    from .patched import crayons
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\patched\crayons.py
", line 49, in <module>
    is_powershell = "powershell" in shellingham.detect_shell()[0]
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\vendor\shellingham
\__init__.py", line 22, in detect_shell
    shell = get_shell(pid, max_depth=max_depth)
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\vendor\shellingham
\nt.py", line 111, in get_shell
    processes = dict(_iter_process())
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\vendor\shellingham
\nt.py", line 77, in _iter_process
    raise WinError()
OSError: [WinError 6] The handle is invalid

Issue description

Using latest Pypy3, but I doubt that has anything to do with my issue as I am able to install packages perfectly fine with other terminal emulators (Windows Terminal, Powershell) & Pipenv.

Expected result

Expected packages (ex. flake8) to install w/o error in Git Bash as they do in any other terminal.

Actual result

[WinError 6] The handle is invalid

Steps to replicate

  • Using Git Bash, install pipenv w/ py -m pip install pipenv -U
  • Attempt to install any package (ex. flake8) w/ pipenv install flake8
  • Observe error.

pipenv --support result:

$ pipenv --support
Traceback (most recent call last):
  File "i:\programs\pypy3.7-v7.3.4-win64\lib-python\3\runpy.py", line 196, in _r
un_module_as_main
    "__main__", mod_spec)
  File "i:\programs\pypy3.7-v7.3.4-win64\lib-python\3\runpy.py", line 85, in _ru
n_code
    exec(code, run_globals)
  File "I:\Programs\pypy3.7-v7.3.4-win64\Scripts\pipenv.exe\__main__.py", line 4
, in <module>
    from pipenv import cli
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\__init__.py", line
 55, in <module>
    from .cli import cli
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\cli\__init__.py",
line 4, in <module>
    from .command import cli    # noqa
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\cli\command.py", l
ine 13, in <module>
    from ..exceptions import PipenvOptionsError
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\exceptions.py", li
ne 14, in <module>
    from .patched import crayons
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\patched\crayons.py
", line 49, in <module>
    is_powershell = "powershell" in shellingham.detect_shell()[0]
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\vendor\shellingham
\__init__.py", line 22, in detect_shell
    shell = get_shell(pid, max_depth=max_depth)
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\vendor\shellingham
\nt.py", line 111, in get_shell
    processes = dict(_iter_process())
  File "i:\programs\pypy3.7-v7.3.4-win64\site-packages\pipenv\vendor\shellingham
\nt.py", line 77, in _iter_process
    raise WinError()
OSError: [WinError 6] The handle is invalid

Aareon avatar May 04 '21 23:05 Aareon

Could you try if the master branch works for you?

$ git clone https://github.com/sarugaku/shellingham.git
$ cd shellingham/src
$ pypy3  # Or however you run the PyPy 3.7 installation in question.
>>> import shellingham
>>> shellingham.detect_shell()

There’s recently a substential rewrite on the Windows logic and I’m curious whether the new implementation still has the same issue.

uranusjr avatar May 06 '21 07:05 uranusjr