Pexpect module first step - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Pexpect module first step (/thread-18530.html) |
Pexpect module first step - slouw - May-21-2019 I am reading up/watching videos and am taking my first baby steps with pexpect. I expected (wrongly) that the sequence below would work. That is I would spawn a process to ssh to the defined host. Is "expect" really not defined within the said module? Appreciate any help.... blah@xxxxx3:~$ python Python 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> >>> import pexpect >>> p = expect.spawn("ssh xxx-xxx-7") Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'expect' is not defined >>> RE: Pexpect module first step - buran - May-21-2019 it need to be pexpect.spawn() - there is missing p at the start
|