Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!newsfeed10.multikabel.net!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'char': 0.07; 'python': 0.08; '__name__': 0.09; 'output': 0.10; 'am,': 0.12; 'helps!': 0.16; 'redirection,': 0.16; 'stdin,': 0.16; 'stdout': 0.16; 'superfluous': 0.16; 'cc:addr:python-list': 0.16; 'subject:Help': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'stick': 0.18; 'file,': 0.19; 'cc:no real name:2**0': 0.20; 'pointed': 0.21; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'somewhere': 0.23; 'correct,': 0.23; 'cc:2**0': 0.24; 'url:mailman': 0.28; 'print': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'chris': 0.30; 'does': 0.32; 'thu,': 0.32; 'actual': 0.32; 'url:listinfo': 0.32; 'header :User-Agent:1': 0.33; 'that,': 0.33; 'it.': 0.34; 'fault': 0.34; 'lie': 0.34; 'url:python': 0.36; 'file': 0.36; 'but': 0.37; 'run': 0.37; 'received:192': 0.37; 'put': 0.38; 'url:org': 0.39; 'why': 0.39; 'received:192.168': 0.40; 'hope': 0.61; '2011': 0.61; 'your': 0.61; 'subject:program': 0.67; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; '29,': 0.73; '11:25': 0.84; 'redirecting': 0.84; 'something.': 0.84; 'redirect': 0.91 Date: Thu, 29 Dec 2011 11:39:29 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: Sayantan Datta Subject: Re: Help in rotate 13 program References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:gL59lDKfF4Ph6jnVc4UUyF8GQdc1d/600ilUq+e6ck7 fCMJJ/3W/o1s5k01YNF7hBIqa2emC7e55YcolwyDARvqCgtS5z 6IGpEUJWQt1FQTtKqLhuGbUwummrpCZR1EFuwi6DevDKOf4MRF +S2me3q3nPm9xWoSQLAY396t8dEha9/hx7nLUy7HkbFSdRUBKy fu36jJaN3TiJeryuQ7aE30f3yAYvhqXpuInHoxWL6BladWS9Av 3A/aOo67PcIBKgE6RaA4qHcETzdkNOzDoM0RD23tcGoILHLe/p CU0pL8GNyoNXj+fWgmanvi99W0UUZLUwg0vutCD7Lv7Hv+KHe9 bJVqIlE6zO2wmi7R/z2Q= Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: d@davea.name 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: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325176785 news.xs4all.nl 6857 [2001:888:2000:d::a6]:43214 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18181 On 12/29/2011 11:25 AM, Sayantan Datta wrote: > On Thu, Dec 29, 2011 at 5:34 PM, Chris Angelico wrote: > >> On Thu, Dec 29, 2011 at 10:48 PM, Sayantan Datta >> wrote: >>> for line in sys.stdin : >>> for char in line : >>> sys.stdout.write(rotate13_letter(char)) >>> >>> cat sample.html | python rot13.py rot13.html >> You're reading from stdin, which is correct, but you're writing to >> stdout and not redirecting it. You need to put an arrow before >> rot13.html to indicate redirection: >> >> cat sample.html | python rot13.py>rot13.html >> >> Note though that 'cat' is superfluous here; all you need to do is >> redirect input: >> python rot13.pyrot13.html >> >> Hope that helps! >> >> Chris Angelico >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > did that, but the output file is still empty? Does the fault lie somewhere > else? > Both Peter and Chris pointed out that you have the if __name__ == "__main__" line indented. If that's true in your actual file, then the program does nothing useful. Why not run it without output redirection, and see what it displays? And stick an unindented print line in there, just to see it do something. -- DaveA