Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an implementation of 'expect' or an expect-like library that works in python3?

I would like to use an expect-like module in python3. As far as I know, neither pexpect nor fabric work with python3. Is there any similar package I can use? (If no, does anyone know if py3 support is on any project's roadmap?)

A perfectly overlapping feature set isn't necessary. I don't think my use case is necessary here, but I'm basically reimplementing a Linux expect script that does a telnet with some config-supplied commands, but extending functionality.

like image 787
belacqua Avatar asked May 15 '12 15:05

belacqua


1 Answers

As Niek mentioned, I ported pexpect, and called it pexpect-u (u for unicode):

http://pypi.python.org/pypi/pexpect-u/

It uses 2to3, but I had to make some changes to the code as well before it worked.

I'm not very interested in maintaining it, but I couldn't get in touch with the author of pexpect, and I felt it was useful enough to be worth publishing. If you're interested in working on it, the code is on Bitbucket. My own need for it was very basic, so there may be bugs I haven't found.

like image 70
Thomas K Avatar answered Sep 26 '22 02:09

Thomas K