Questions tagged [wexpect]

9 questions
4
votes
1 answer

Wexpect freezes at spawn() method

When I run the example code from wexpect, it freezes on the spawn method. import wexpect prompt = '[A-Z]\:.+>' child = wexpect.spawn('cmd.exe') child.expect(prompt) # Wait for startup prompt child.sendline('dir') # List the current…
Domin
  • 41
  • 2
2
votes
3 answers

run an executable using wexpect

I have an executable (evapo.exe) which has to be called with an input file (inputs.prj), usually I do it using windows command prompt by just typing c:\myfiles\evapo inputs.prj (of course both the executable and input file located in myfiles…
Eric Gentil
  • 261
  • 1
  • 3
  • 8
1
vote
4 answers

How to write a code to get another python script output that require an input

I want to give score to several python scripts written by different people and i want to automate the answer check since the given question is same. So we send an input to another python file, we get the output (the terminal/console output) then we…
Yusuf Syam
  • 701
  • 1
  • 4
  • 18
1
vote
1 answer

wexpect equivalent for logging

I have the following codes using pexpect in linux it is ok. import pexpect child = pexpect.spawn('ssh test@ip' % (susername, ip) , encoding='utf-8') child.logfile = open("{}/{}.txt".format(folder, ip),"w") when have tried to change to wexpect to…
Andy
  • 11
  • 3
1
vote
1 answer

Problems when trying to use wexpect for controlling sub-process

i'm trying to use wexpect on windows machine, and facing issues in the very basic operations. i'm running the following command: import wexpect child = wexpect.spawn('cmd.exe') child.send('dir') and getting the following…
Moish
  • 11
  • 1
1
vote
3 answers

How to install wexpect?

I'm running 32-bit Windows XP and trying to have Matlab communicate with Cgate, a command line program. I'd like to make this happen using wexpect, which is a port of Python's module pexpect to Windows. I'm having trouble installing or importing…
Justine
  • 31
  • 1
  • 3
1
vote
2 answers

Running wexpect on windows

I have installed wexpect on Windows 7. Now, when I am trying to run any command, I am getting the below error. I am using MKS toolkit, so ls is a valid command. >>> import pexpect >>> pexpect.run('ls ') Traceback (most recent call last): File…
sarbjit
  • 3,786
  • 9
  • 38
  • 60
0
votes
1 answer

Wexpect in a Python Virtual Environment

When run in cmd window, the spawn command works fine, but if in a virtual environment, it hangs forever. 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…
Deepstop
  • 3,627
  • 2
  • 8
  • 21
0
votes
1 answer

How do I get wexpect to interact a python script?

Folks, I would like to know if there is an issue w/ wexpect. Is this module working as expected? things seem to work as expected in pexpect on linux import wexpect child = wexpect.spawn('cmd') child.expect('>') #instantaneous…
Sblu
  • 43
  • 8