Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96133

Re: issue while doing pexpect ssh

Path csiph.com!goblin3!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; '===========': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'str,': 0.09; 'subject:while': 0.09; 'sys.stdout': 0.09; 'typeerror:': 0.09; 'python': 0.10; 'question.': 0.13; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:issue': 0.16; 'subject:ssh': 0.16; 'wrote:': 0.16; 'bytes': 0.18; '2015': 0.20; 'sep': 0.22; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'header :User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'chris': 0.26; 'error': 0.27; 'actual': 0.28; 'key,': 0.29; 'url:client': 0.29; 'getting': 0.33; 'tue,': 0.34; 'follows:': 0.35; 'level': 0.35; 'but': 0.36; 'url:org': 0.36; 'child': 0.36; 'to:addr :python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:org': 0.37; 'missing': 0.37; 'url:en': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'your': 0.60; 'received:194': 0.61; 'charset:windows-1252': 0.62; 'low': 0.83; '=====': 0.84; '============': 0.84; 'beside': 0.84; 'chrisa': 0.84; 'subject:doing': 0.84; 'url:api': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From jmp <jeanmichel@sequans.com>
Subject Re: issue while doing pexpect ssh
Date Tue, 08 Sep 2015 16:56:50 +0200
References <3f4642c2-d548-4089-87c2-f3abb4ccb224@googlegroups.com> <CAPTjJmrTXFxAjL_MpRO4d++GGd_dCc1Morf7=n7S6JimRo=U_g@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host paris.sequans.com
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
In-Reply-To <CAPTjJmrTXFxAjL_MpRO4d++GGd_dCc1Morf7=n7S6JimRo=U_g@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.226.1441724225.8327.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1441724225 news.xs4all.nl 23846 [2001:888:2000:d::a6]:46740
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:96133

Show key headers only | View raw


On 09/08/2015 03:57 PM, Chris Angelico wrote:
> On Tue, Sep 8, 2015 at 9:37 PM,  <harirammanohar159@gmail.com> wrote:
>> Some where i am missing simple logic.... :)
>>
>> =====
>> child = pexpect.spawn('ssh hari@hostname')
>> child.logfile = sys.stdout
>> child.expect('hari\'s Password: ')
>> =====
>>
>> getting error as follows:
>> ============
>> child.expect('hari\'s Password: ')
>> TypeError: must be str, not bytes
>> ===========
>
> Laura's already answered your actual question. But I would recommend
> using public key login [snip]
>
> ChrisA
>

My 2 cents, beside the public key, use the python module paramiko, 
unless you really want to work at the low level yourself.

http://docs.paramiko.org/en/1.15/api/client.html

JM

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

issue while doing pexpect ssh harirammanohar159@gmail.com - 2015-09-08 04:37 -0700
  Re: issue while doing pexpect ssh Laura Creighton <lac@openend.se> - 2015-09-08 14:12 +0200
  Re: issue while doing pexpect ssh Chris Angelico <rosuav@gmail.com> - 2015-09-08 23:57 +1000
  Re: issue while doing pexpect ssh jmp <jeanmichel@sequans.com> - 2015-09-08 16:56 +0200
  Re: issue while doing pexpect ssh Laura Creighton <lac@openend.se> - 2015-09-08 18:43 +0200
  Re: issue while doing pexpect ssh harirammanohar159@gmail.com - 2015-09-09 01:58 -0700
    Re: issue while doing pexpect ssh Laura Creighton <lac@openend.se> - 2015-09-09 12:45 +0200
  Re: issue while doing pexpect ssh harirammanohar159@gmail.com - 2015-09-09 02:19 -0700
    Re: issue while doing pexpect ssh Laura Creighton <lac@openend.se> - 2015-09-09 12:47 +0200
  Re: issue while doing pexpect ssh harirammanohar159@gmail.com - 2015-09-09 04:22 -0700
  Re: issue while doing pexpect ssh harirammanohar159@gmail.com - 2015-09-09 22:18 -0700
  Re: issue while doing pexpect ssh harirammanohar159@gmail.com - 2015-09-09 23:08 -0700

csiph-web