pexpect Questions
2
Solved
I need to call a shellscript from python.
The problem is that the shellscript will ask a couple of questions along the way until it is finished.
I can't find a way to do so using subprocess! (usin...
Watercourse asked 31/5, 2013 at 10:55
5
Solved
When we run docker-compose up-d command to run dockers using docker-compose.yml file, it starts building images or pulling images from the registry. We can see each and every step of this command o...
Sacrum asked 14/2, 2018 at 9:22
5
Solved
I need to do something like this post, but I need to create a subprocess that can be given input and give output many times. The accepted answer of that post has good code...
from subprocess impor...
Annunciate asked 19/2, 2015 at 20:13
8
child = pexpect.spawn ('/bin/bash')
child.sendline('ls')
print(child.readline())
print child.before, child.after
All I get with this code in my output is
ls
ls
But when my code is
child =...
2
Solved
I am working with pythons pexpect module to automate tasks, I need help in figuring out key characters to use with sendcontrol. how could one send the controlkey ENTER ? and for future reference ho...
1
I successfully open an ssh connection with paramiko.
As i have want to use pexpect for automatic interaction with the system on the remote end, I would like to to pass the paramiko connection to p...
4
Solved
I am using Fabric and would like to use fexpect. I have the following Python script:
from ilogue.fexpect import expect, expecting, run
(...)
def install_postgresql(profile):
print("!!! Installin...
3
I'm trying to write a cross-platform tool that runs specific commands, expects certain output for verification, and sends certain output (like username/password) for authentication.
On Unix, I hav...
Endodontist asked 16/8, 2016 at 13:56
1
I am familiar with expect script so I feel a bit odd when I first use pexpect. Take this simple script as an example,
#!/usr/bin/expect
set timeout 10
spawn npm login
expect "Username:"
s...
3
Solved
I'm trying to make a program which takes an executable name as an argument, runs the executable and reports the inputs and outputs for that run. For example consider a child program named "cir...
Shenitashenk asked 9/6, 2020 at 17:32
3
Solved
I'm currently passing some input to a process with pexpect with the following code:
p = pexpect.spawn('cat', timeout=5.0 )
p.maxread = 5000
p.setecho(False) # prevent the process from echoing stdi...
3
Solved
I'm trying to do a lengthy operation but pexpect with the timeout argument doesn't seem to change the length of time before the timeout exception gets fired. Here is my code:
child = pexpect.spawn...
2
In the following code snippet, how do I find the exit code of make? Specifically, I need to know if make has failed or succeeded. Thanks for any inputs.
process = pexpect.spawn("/bin/bash")
proces...
2
Solved
I want to run wexpect (the windows port of pexpect) on my Windows 7 64-bit machine. I am getting the following error:
C:\Program Files (x86)\wexpect\build\lib>wexpect.py
Traceback (most recent ...
3
Solved
I have finally have my python pexpect script working except for the most important part updating the date! I am able to SSH in the box but my second command does not execute properly. I have been b...
2
Solved
I have a Python project that uses pytest-cov for unit testing and code coverage measurement.
The directory structure for my project is:
rift-python
+- rift # The package under test
| +- __init__....
Isobel asked 2/8, 2018 at 22:19
4
Solved
I am migrating my code to python 3.4.3. This code works fine in python 2.4.3. but here it throws error in python 3.4.3.
should I use anything different from expect ?
Here is my code snippet which g...
Reckoner asked 11/2, 2016 at 3:46
1
I am trying to use pexpect on serial port. I use fdpexpect as suggested. But I noticed that expect() does not obey timeout. Instead, the EOF happens.
ser = serial.Serial(sys.argv[1], 9600)
fd = fd...
Helfand asked 27/4, 2016 at 3:25
2
Solved
I am trying to have pexepct stdout logs via logger that I have defined. Below is the code
import logging
import pexpect
import re
import time
# this will be the method called by the pexpect object...
Gavra asked 15/6, 2018 at 7:50
1
Solved
I'm trying to bring up [pipenv][1] on a Raspberry Pi Zero W. The symptom I'm seeing is that pexpect times out when trying to create a tutorial project.
Admittedly, the RPi is a small machine, but ...
Eisenach asked 17/5, 2018 at 3:18
3
I'm trying to run the code in the Interacting with SSH Through Pexpect and Brute Forcing SSH Passwords with Pxssh sections from Chapter 2 of Violent Python. Using both child.expect() and pxssh I ge...
Pressroom asked 26/7, 2013 at 10:57
1
I've used pexpect on linux successfully to telnet/ssh into Cisco switches for CLI scrapping. I'm trying to convert this code over to Windows and having some issues since it doesn't support the pxpe...
Sternum asked 30/11, 2017 at 21:13
3
I have write this program:
[mik@mikypc ~]$ cat ftp.py
#!/usr/bin/env python
# This connects to the rediris ftp site
#
import pexpect
child = pexpect.spawn('ftp ftp.rediris.es')
child.exp...
1
This is the code I am trying to run:
from pexpect import pxssh
s = pxssh.pxssh()
if not s.login ('myip', 'myusername', 'mypassword'):
print ("SSH session failed on login.")
print (str(s))
else:
...
Fishgig asked 26/4, 2016 at 19:21
1
Solved
I am connecting to device using code blow on MacOS and out of 100 times this code would make connection only 1 or two times and dones't respond(since there is no timeout) rest of the times.
ser = ...
Byre asked 27/9, 2016 at 1:30
1 Next >
© 2022 - 2025 — McMap. All rights reserved.