Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
118 views

Python - Correct way to get string without ANSI chars and also print pexpect data

Currently, for these few days I have created a working code that works as I would expect, but there is one significant problem that I do not know how to solve. But let's start from the beginning. I ...
Ownedds's user avatar
  • 27
0 votes
1 answer
330 views

pexpect.expect('(?<=Code:\s).*(?=[\r\n])') sometimes got unexpected result from multiline output

I'm new to learning python and pexpect and I'm trying to check if a dictionary is equal to a certain string from some command output but for some reason the string comparison fails on the rare ...
william's user avatar
  • 33
0 votes
2 answers
81 views

Printing output of a spawned process results in a badly formatted output: why?

I'm trying to execute a python program from another python program using the pexpect library, but I don't get the behavior I was expecting. I would like the output of the first program (prog1.py) to ...
Robb1's user avatar
  • 5,027
0 votes
1 answer
65 views

error trying to capture a part from a string python [closed]

im tring to capture a part from a string im giving it the location i want in integers but it keep telling me its tuple i don't know why im using pexpect to get a version from network device ...
idan357's user avatar
  • 377
0 votes
0 answers
143 views

pexpect doesn't see string

I'm using pexpect to compare the output from a spawned program. It sees everything I want until it gets to a certain point. Here is what I am looking for: DeviceId 12001055 Waiting to check firmware ...
user3365715's user avatar
0 votes
1 answer
1k views

pexpect parse a string

I have an expected string "Version 0.0.9999.0" I do the spawn correctly then e.expect('Version 0.0.9999.0') and this works fine, however, I want to make it dynamic to accept any version (any 4 ...
CSawy's user avatar
  • 924
1 vote
0 answers
266 views

Is it necessary to check the return value of spawn.send in pexpect?

Is it necessary to check the return value of send in pexpect? The implementation of spawn.send(s) is using something like: c = os.write(self.child_fd, s) return c Where the number of bytes are ...
wim's user avatar
  • 365k
0 votes
1 answer
2k views

Python Pexpect: TypeError: unsupported operand type(s) for %: 'int' and 'dict'

When I try to run the following pexpect command i get the error: TypeError: unsupported operand type(s) for %: 'int' and 'dict'. I do not really understand why I am getting this error. When I do a ...
WorkerBee's user avatar
  • 703