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


Groups > comp.lang.python > #19028

Re: Problem while doing a cat on a tabbed file with pexpect

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <torriem@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python,': 0.01; 'subject:while': 0.07; 'python': 0.08; 'context.': 0.09; 'ssh': 0.09; 'subject:Problem': 0.09; 'subject:file': 0.13; 'question.': 0.15; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'simplified': 0.16; 'wrote:': 0.16; 'header:In-Reply-To:1': 0.22; 'module': 0.26; 'pm,': 0.26; 'posted': 0.27; "i'm": 0.27; 'remote': 0.27; 'example': 0.28; "can't": 0.32; 'message- id:@gmail.com': 0.33; 'it.': 0.33; 'header:User-Agent:1': 0.33; 'to:addr:python-list': 0.33; 'there': 0.33; 'operating': 0.35; 'file': 0.35; 'received:org': 0.37; 'could': 0.37; 'subject:with': 0.38; 'received:192': 0.38; 'open': 0.38; 'why': 0.39; 'either': 0.39; 'called': 0.39; 'doing': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'ali': 0.67; '05:11': 0.84; 'saqib': 0.84
X-Virus-Scanned amavisd-new at torriefamily.org
Date Sun, 15 Jan 2012 20:47:31 -0700
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Lightning/1.0b3pre Thunderbird/3.1.16
MIME-Version 1.0
To python-list@python.org
Subject Re: Problem while doing a cat on a tabbed file with pexpect
References <d33374b9-de51-4cfa-b05d-0bb13fdf79f3@f11g2000yql.googlegroups.com> <mailman.4778.1326655502.27778.python-list@python.org> <4008c5d1-98c5-4796-9e82-0e8835fbe42a@i25g2000vbt.googlegroups.com>
In-Reply-To <4008c5d1-98c5-4796-9e82-0e8835fbe42a@i25g2000vbt.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4785.1326685659.27778.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326685659 news.xs4all.nl 6879 [2001:888:2000:d::a6]:59275
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19028

Show key headers only | View raw


On 01/15/2012 05:11 PM, Saqib Ali wrote:
> 
> Very good question. Let me explain why I'm not opening me.txt directly
> in python with open.
> 
> The example I have posted is simplified for illustrative purpose. In
> reality, I'm not doing pexpect.spawn("/bin/tcsh"). I'm doing
> pexpect.spawn("ssh myuser@ipaddress"). Since I'm operating on a remote
> system, I can't simply open the file in my own python context.

There is a very nice python module called "paramiko" that you could use
to, from python, programatically ssh to the remote system and cat the
file (bypassing any shells) or use sftp to access it.  Either way you
don't need to use pexpect with it.

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


Thread

Problem while doing a cat on a tabbed file with pexpect Saqib Ali <saqib.ali.75@gmail.com> - 2012-01-15 09:51 -0800
  Re: Problem while doing a cat on a tabbed file with pexpect Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-01-15 14:24 -0500
    Re: Problem while doing a cat on a tabbed file with pexpect Saqib Ali <saqib.ali.75@gmail.com> - 2012-01-15 16:11 -0800
      Re: Problem while doing a cat on a tabbed file with pexpect Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-01-15 22:35 -0500
      Re: Problem while doing a cat on a tabbed file with pexpect Michael Torrie <torriem@gmail.com> - 2012-01-15 20:47 -0700
  Re: Problem while doing a cat on a tabbed file with pexpect Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-15 23:04 +0000
    Re: Problem while doing a cat on a tabbed file with pexpect Cameron Simpson <cs@zip.com.au> - 2012-01-16 10:40 +1100
      Re: Problem while doing a cat on a tabbed file with pexpect Saqib Ali <saqib.ali.75@gmail.com> - 2012-01-15 16:14 -0800
        Re: Problem while doing a cat on a tabbed file with pexpect Cameron Simpson <cs@zip.com.au> - 2012-01-16 12:45 +1100
  Re: Problem while doing a cat on a tabbed file with pexpect Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-16 02:01 +0000

csiph-web