Skip to content
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

spawn hangs when run in virtual environment #51

Open
SullivanChrisJ opened this issue Jul 9, 2021 · 4 comments
Open

spawn hangs when run in virtual environment #51

SullivanChrisJ opened this issue Jul 9, 2021 · 4 comments

Comments

@SullivanChrisJ
Copy link

Describe the bug

When run in cmd window, the spawn command works fine, but if in a virtual environment, it hangs forever.

To Reproduce

This works

C:\Users\csullivan\Documents\Projects\netlog>python
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from wexpect import spawn
>>> spawn("cmd.exe")
<wexpect.host.SpawnPipe object at 0x0000019F7040DBB0>
>>>

but this does not return from spawn.

(env) C:\Users\csullivan\Documents\Projects\netlog>python
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from wexpect import spawn
>>> spawn("cmd.exe")

Expected behavior
I would expect identical behaviour in a Python Virtual Environment if software versions are the same, which they are.

Environment:
Microsoft Windows 10 Pro 10.0.19043 Build 19043
Dell Latitude 7490
Python 3.9.5
wexpect 4.0.0

Additional context
Submitted this as a question to Stack Overflow.

@raczben
Copy link
Owner

raczben commented Jul 9, 2021

@SullivanChrisJ
Copy link
Author

SullivanChrisJ commented Jul 11, 2021

I am using virtualenv, not venv. The python -c "import sys; print(sys.executable)" test shows the virtualenv version of Python, not the system-wide one. Using subprocess directly, Popen returns an object as expected. Sorry I didn't make that clear on the OP, I'd forgotten about venv.

@raczben
Copy link
Owner

raczben commented Jul 15, 2021

Hi,

As @ddeel has found in this comment:

Release 20.0.34 that says "Align with venv module when creating virtual environments with builtin creator on Windows 3.7 and later"

This means that the now the same thing can happen both in venv and virtualenv.

The 850eece shows a way to solve this issue in all virtualenv. This implementation does not uses the child process' pid to identify the pip.

@ScriptPup
Copy link

Was a solution or workaround for this ever implemented? I just tried building from source in case it was only in the dev build, but I'm still unable to use wexpect within a virtual environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants