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

Stuck in loop trying to initialize pipe #58

Open
Stefanhg opened this issue Sep 26, 2023 · 3 comments
Open

Stuck in loop trying to initialize pipe #58

Stefanhg opened this issue Sep 26, 2023 · 3 comments

Comments

@Stefanhg
Copy link

Stefanhg commented Sep 26, 2023

Describe the bug
Hello,
I was working on some tests and then transferred them to a new computer. After transferring i cannot spawn my object.
I went back to 101 and just spawn cmd.exe but that also fails. Tried multiple computers with the same result.

To Reproduce

import wexpect
child = wexpect.spawn('cmd.exe')
child.expect('>')

Expected behavior
It simply just being able to execute 'cmd.exe

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:
Windows version: Windows 10 22H2
Python version: Python 3.10.6, tested on 3.8.10
wexpect version: 4.0.0

Additional context
If i go back to 3.3.1 it does manage to spawn, but no data is in the buffer child.buffer
I also tried to install tip of wexpect which does not fix the issue.

Traceback:

D:\Test\test_wexpect>python test_expect.py
Traceback (most recent call last):
  File "C:\Users\shg\AppData\Local\Programs\Python\Python310\lib\site-packages\wexpect\host.py", line 900, in connect_to_child
    self.pipe = win32file.CreateFile(
pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified.')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Test\test_wexpect\test_expect.py", line 2, in <module>
    child = wexpect.spawn('cmd.exe')
  File "C:\Users\shg\AppData\Local\Programs\Python\Python310\lib\site-packages\wexpect\host.py", line 877, in __init__
    super().__init__(
  File "C:\Users\shg\AppData\Local\Programs\Python\Python310\lib\site-packages\wexpect\host.py", line 248, in __init__
    self.connect_to_child()
  File "C:\Users\shg\AppData\Local\Programs\Python\Python310\lib\site-packages\wexpect\host.py", line 918, in connect_to_child
    time.sleep(0.2)
KeyboardInterrupt
^C

Logfile
wexpect_1660.log

@Stefanhg
Copy link
Author

It seems like i found a pattern.
First up virtualenv seems like it is a nogo which I think i have also read somewhere here.
Second you HAVE to install python shared for all users. Then I managed to get it working.
Why? No idea at all.. More testing ongoing

@Stefanhg
Copy link
Author

I uninstalled all Py versions
Installed Python 3.10.10:
Checked "add Python to Environment variables" and "Install Python 3.10 for all users" in install setup
Afterwards i did pip install wexpect
And then executed To Reproduce
Result was a success. CMD process was started and working.

So now it comes down to... What can cause this

@Stefanhg
Copy link
Author

I have a feeling that this is also related to #51 (comment)

I am guessing that a venv and user env is the same and therefore both sharing the same problem.

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

1 participant