How to wrap a CLI program in Python (while maintaining interactivity)?

I would like to write a shell for an interactive CLI program (Asterisk CLI).

Basically, I need to maintain interaction with the CLI (including tabs), but I want to filter out the Asterisk output to show only lines matching this pattern.

I tried the select () based approach using popen.popen4 and put the asterisk stdout_and_stderr and sys.stdin in read_fs, but it didn't seem to work.

Can anyone give me some good recommendations?

Thanks a lot Andrea

+3
source share
2 answers

Pexpect : http://sourceforge.net/projects/pexpect/

-: "Pexpect - Python , . Pexpect , ssh, ftp, passwd, telnet .. Pexpect - Python."

+6

http://code.google.com/p/py-asterisk/

Python Asterisk ( py-Asterisk) , Python API- Asterisk.

- Asterisk Python, , , Asterisk.

Python, - . API- .

0

Source: https://habr.com/ru/post/1720346/


All Articles