pexpect

term

programmingnetworking

Kept in this browser · My desk

A pure Python module, modelled on Expect, that spawns a program on a pseudo-terminal, waits for patterns in its output and sends it input.

It brought Expect's model to the language most network automation is now written in, with the same habits and a few traps of its own: a timeout that raises an exception after 30 seconds where Expect carries on after 10, a sendline that ends with a linefeed where a device documents the Enter key, and a $ that its documentation calls useless for finding the end of a line. Ansible's expect module requires it.

Also known as: python expect, pexpect.spawn

← Back to P Back to the glossary