Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'output': 0.05; 'subject:Python': 0.06; 'assign': 0.07; 'subject:file': 0.07; 'variables': 0.07; 'wednesday,': 0.07; 'subject:script': 0.09; '(when': 0.16; '>on': 0.16; 'btw': 0.16; 'cet': 0.16; 'proc': 0.16; 'top-post': 0.16; 'files.': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'command': 0.22; '>>>': 0.22; 'input': 0.22; 'header:Received:8': 0.24; 'to:2**1': 0.27; 'to:no real name:2**1': 0.29; 'robert': 0.30; 'url:mailman': 0.30; 'url:wiki': 0.31; 'url:wikipedia': 0.31; 'file': 0.32; 'run': 0.32; 'url:python': 0.33; 'there': 0.35; 'url:listinfo': 0.36; 'method': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'should': 0.36; 'skip:- 20': 0.37; 'to:addr:python-list': 0.38; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'read': 0.60; 'received:98.137': 0.60; 'march': 0.61; 'name': 0.63; 'to:addr:gmail.com': 0.65; 'dont': 0.67; 'mar': 0.68; 'received:gq1.yahoo.com': 0.68; 'received:mail.gq1.yahoo.com': 0.68; 'received:98.136': 0.69; '2015': 0.84; 'received:bullet.mail.gq1.yahoo.com': 0.84 X-Yahoo-Newman-Property: ymail-4 X-Yahoo-Newman-Id: 692775.51388.bm@omp1036.mail.gq1.yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1426710120; bh=LTknt59aBZuhHD7ep6E8cVuRcCKLhT2Tl5oZNSatxBs=; h=Message-ID:Date:From:Subject:To:MIME-Version:Content-Type; b=shsmrW++1sjIxiNpJvu0FrryovD2lPzaGn3DSnCpviGyKgmrWOoAmHgNQKWzN3d0m1YTbayb+c36QKAp+XNCQqQUlq7r6oZW4qN9WNVmHPRvYTU2mKDSlZq/PZS5mJWUQQongtN0RtHEEcg2MpwKP44cqUqI4VjieYTwCakdJUQ= X-YMail-OSG: K_8pmZoVM1nr2hSj7Xx5iHWQ76BEbh1MYsM_UVENOxJpFLP gdBg4Fz44yijAsiUFefSRLKkhQy4RSdZORC6Ir4nfPaCCNzMj4mFNV_7GNza n6cuYeYioA7HiHyxuDw3HW9ZQPP.xohZpiCc3Mt1ehwLh._8hcpQcyPQRC_f 7NXRLjkbFci30.7aXZ1N7Z1LVHsC0DJngKL2kCjZaIuXVqKyvIBDazlp8.PK LSYbFT6iEVojttjRPUJkdzbdyDej_GRH7ZpaWLi4zdWVsl8C9a47CbP21FLJ TBIE1cnnXiYhcBO5u0R709kkr6tHr4dvrS963wQUPRC7qanX8howh5zVqfa8 EOntLUB07CTIdceKsz2790wOuU1DEYYVAFV5v_nSPcnIz456C_HqlFS0sd0t PH2QQr2YEpIS4lWchZr24iB4CZwqS99tMbEXNxmxXr360yoGw0hlCxXbOqcj fUDISrT5m5mfKqoXeS1r6.VYwR.5BStERpqpKjUKhGu4imtCPtpf0a_rE1zS nIq0D.FElkKKuc090ZkmoI1F0Ck5lsPygBaeilo6hoKZPrkT2p7ocv9YIU87 wMdMAF58PbUPXEDkBp_.Ap9ZWKQeht9Vt7ZRxTEnejj0D79hDXc6M8KoF98J jhEivSt.AWNs1rXM_e3nhhg7XQpSggZBp1H46eHjD8RIUsD..14f2VDtaOlR Bcs1PXTaUW_xaDpAm6yMJysvb1n78LBl49uLjqnWM.VoNrxySfBUidlA3_Lz 5Z.CHGVfHT73neb17KkDg9LLNDsJJ0HvGjaYFTFav5GCZQwV573QIw9nFGu3 VSy0- X-Rocket-MIMEInfo: 002.001, Ci0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCk9uIFdlZCwgTWFyIDE4LCAyMDE1IDc6MDYgUE0gQ0VUIFJ1c3RvbSBNb2R5IHdyb3RlOg0KDQo.T24gV2VkbmVzZGF5LCBNYXJjaCAxOCwgMjAxNSBhdCA4OjEyOjEyIFBNIFVUQys1OjMwLCBSb2JlcnQgQ2xvdmUgd3JvdGU6DQo.PiAuL215X2V0aF9zY3JpcHQucGwgZXRoMCBNID4gYS50eHQNCj4.IA0KPj4gSG93IGNhbiBpIHJ1biB0aGlzIGNvbW1hbmQgd2l0aCBzdWJwcm9jZXNzLnBvcGVuDQo.DQo.U29tZXRoaW5nIGxpa2UgdGhpcyBJIGd1ZXNzPw0BMAEBAQE- X-Mailer: YahooMailWebService/0.8.203.740 Date: Wed, 18 Mar 2015 13:22:00 -0700 From: Albert-Jan Roskam Subject: Re: Python script output in file To: rustompmody@gmail.com, python-list@python.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1426710494 news.xs4all.nl 2887 [2001:888:2000:d::a6]:41807 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87699 ---------------------------- On Wed, Mar 18, 2015 7:06 PM CET Rustom Mody wrote: >On Wednesday, March 18, 2015 at 8:12:12 PM UTC+5:30, Robert Clove wrote: >> ./my_eth_script.pl eth0 M > a.txt >> >> How can i run this command with subprocess.popen > >Something like this I guess? > >>> proc = Popen("cat", shell=True, stdout=open(inname, "w"), stdin=open(outname,"r")) How will the file object associated with in name be closed? (When is close() method called? >inname and outname should be appropriate input (existing) and output (to be created) files. ie put the strings directly there or assign to the variables >prior to the Popen call > >And BTW >Two suggestions >1. Read the docs >2. Dont top-post https://en.wikipedia.org/wiki/Posting_style#Top-posting >-- >https://mail.python.org/mailman/listinfo/python-list