Comments (8)
Without looking into it too deeply, this is likely caused by a very long file path. Do you have long paths enabled? Can you think of a possible candidate executable that has a very long path in your system? That would help explain the phenomenom.
(This is more a note to self) I think it would likely be sufficient if we just ignore that entry and keep looking. It is highly unlikely the offending process is the shell we are looking for anyway—and we can always deal with it if someone ever needs to detect that process.
from shellingham.
If you want to try whether my guess is correct right now, modify nt.py
and change Process32Next
like this:
def Process32Next(hSnapshot, pe=None):
if pe is None:
pe = PROCESSENTRY32()
pe.dwSize = sizeof(PROCESSENTRY32)
success = windll.kernel32.Process32Next(hSnapshot, byref(pe))
if not success:
if windll.kernel32.GetLastError() == ERROR_NO_MORE_FILES:
return
if windll.kernel32.GetLastError() == 122: # ERROR_INSUFFICIENT_BUFFER.
return pe # If this does not work, try "return".
raise WinError()
return pe
and see if that works.
from shellingham.
Seems likely to work ok at a glance, and a good safety measure to build in anyway
from shellingham.
Thanks for taking a look! Unfortunately, I might not have a moment to give it a try until next week.
from shellingham.
No hurry, this is not pressing at the moment :)
from shellingham.
I edited Process32Next as instructed and success!!!
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import shellingham
>>> shellingham.detect_shell()
('cmd', 'cmd.exe')
from shellingham.
In addition, this was related to attempting to using pipenv shell and having the WinError. Making this same correction in the shellingham used in Pipenv resolved the problem. I suppose Pipenv should be advised to include this correction as well if it passes. Glad to help any anyway, but don't want to overstep.
Before change to .\pipenv\vendor\shellingham\nt.py Process32Next:
Traceback (most recent call last):
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\rshuhart001\AppData\Local\Continuum\anaconda3\Scripts\pipenv.exe\__main__.py", line 9, in <module>
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\vendor\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\vendor\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\vendor\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\vendor\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\cli.py", line 664, in shell
three=three, python=python, fancy=fancy, shell_args=shell_args, pypi_mirror=pypi_mirror
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\core.py", line 2149, in do_shell
shell = choose_shell()
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\shells.py", line 217, in choose_shell
type_, command = detect_info()
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\shells.py", line 25, in detect_info
return shellingham.detect_shell()
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\vendor\shellingham\__init__.py", line 24, in detect_shell
shell = get_shell(pid, max_depth=max_depth)
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\vendor\shellingham\nt.py", line 117, in get_shell
processes = get_all_processes()
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\vendor\shellingham\nt.py", line 97, in get_all_processes
pe = Process32Next(h_process, pe)
File "c:\users\rshuhart001\appdata\local\continuum\anaconda3\lib\site-packages\pipenv\vendor\shellingham\nt.py", line 74, in Process32Next
raise WinError()
OSError: [WinError 122] The data area passed to a system call is too small.
After change to .\pipenv\vendor\shellingham\nt.py Process32Next:
Launching subshell in virtual environment…
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
(shellingham_test-5dV6dxIr) C:\Users\rshuhart001\Documents\...\Other\shellingham_test>
Ryan
from shellingham.
We maintain pipenv also (this code was written for pipenv and most of the tooling in this organization is for pipenv) so this will land in the next release
from shellingham.
Related Issues (20)
- Can we correctly detect the full path of the shell for windows? HOT 3
- Officially support Python 3.7+ HOT 3
- WinError using pipenv in Pypy HOT 1
- Shell detection failure inside docker image on ARM Macbook HOT 10
- New release HOT 6
- [1.5.0] Incorrectly List by Pypi as Available for Python < 3.7 HOT 1
- [1.5.0] Please Yank 1.5.0 and Release 1.5.1 for Limit package installation to Python >= 3.7 HOT 2
- Doesn't detect powershell on win32 HOT 5
- doesn't detect bash on win32 HOT 7
- [Question] Are you open to adding type annotations? HOT 3
- sdist is missing tests HOT 1
- Fails to detect shell in docker containers run with rosetta on Apple Silicon HOT 1
- error with shellingham HOT 1
- ShellDetectionFailure for zsh HOT 10
- unsupported proc format HOT 6
- tests/test_posix.py::test_get_shell[mapping0-result0] fails with 1.5.2+ HOT 1
- Always detects fish
- Configure Pypi trusted publishing pipeline HOT 1
- Dash prefix does not always imply login shell HOT 1
- Failure to resolve sh -c bash HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shellingham.