Forum Archive

pexpect Module

Tizzy

There is a python module called pexpect which allows for computational control of interactive command line programs such as ssh, telnet or others. (https://pexpect.readthedocs.org/en/latest/)

I installed it using Pypi

from Pypi import Installer
    Installer('pexpect','3.3').install()

It seemed to install without errors.

But when, in an empty script, I import it, I get an error.

import pexpect
#-->A critical module was not found. Probably this operating system does not...

and then I can't see the rest on my iPhone 6+, it goes off the screen.

This module works on my mac. Any ideas?

UPDATE: I also tried moving all the individual files into my site-packages folder but this also doesn't work.

omz

From looking at the pexpect source code, it seems like the modules resource, pty, tty, and termios are the culprits... these aren't included in Pythonista. While it might be possible to get some of these to work on iOS, pty is pretty much off-limits since it relies on being able to fork sub-processes, which isn't possible due to sandboxing...