Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Other difference with Perl: Python scripts in a pipe Date: Thu, 10 Mar 2016 14:46:50 -0700 Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de vyvUWT5UcBI6jRFCygwslQlyJwTycPMuwUhRdGPM7Syg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'python3': 0.05; 'sys': 0.05; 'python': 0.10; 'thu,': 0.15; '2016': 0.16; 'range(20):': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'commands,': 0.22; 'pipe': 0.22; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'script': 0.25; 'message-id:@mail.gmail.com': 0.27; 'cat': 0.29; 'doing?': 0.29; 'this?': 0.34; 'received:google.com': 0.35; 'problem.': 0.35; 'received:209.85': 0.36; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'your': 0.60; 'avoid': 0.61; 'mar': 0.65; 'to:name:python': 0.84; 'refuse': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=tBf2xUWoSZBp/RDdvmiARr1+hOA96DOHlkCU09gkX/c=; b=AksCWqTU2AiOHGoMXYQXeCs9m6lLnDkjerRYMuCIWq4DQQ66ToSqb37GJYse5zVM8w Vg/z4gHE1SSt99GWNM1a/+dSgZRlSLRe8VxAkho0BzzWuJ/pqgZUaX+novJBdx1vVYbG vZfOzrQL0eqVqAT7JaDA0VIOCoaUyFddIweuIEGqs9+OUMq5nHN/yc/+3NCSlo7j4sun SUtAGuYKZCLf5dn6uiZw0qXKgmqu2Ob0kAFO+cCqu6nEVJMkDM/9n4pWssOvg9uJIMF7 B1+ovsM+uRokIsshkl39BFRUyLXyV4e/AFTyoiCgCwgVCFOaGLoXgqlK8xdG5JGTWtG8 gn0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=tBf2xUWoSZBp/RDdvmiARr1+hOA96DOHlkCU09gkX/c=; b=ECDFJ6VizTV+EJOZlrlIuifBT/V8uW/8ObLjbGmm2akJV9uwozEV6mC0tJZh1zkV67 D0Kil70DU/KRH1UL6UgFy+i6C6kWRD01q8LGr+fMqBVTmiO2ASU6Hh7n8ZaOlpletvVq 9xfj5epi3Gb7SEL7rNif4Pr1rjBlU1snbJewp1vkyNgqPmSONEJtCDE4hxRg4KgNtIu9 ENH6Lw93b+vtuH4gtbE0GGxul88d1ewBv7DTDZ3QixuxOY6NRuoAwJAIV+ywCyzHKzWa qh+q6pe5xebPsuD49OdG4NJZr4XWZeZQe+7A+MEaWU4S9AZ6BdgZ3erteWxDQ2s69+zd Pdpw== X-Gm-Message-State: AD7BkJJhggVq01WuD3KgV6VQX8P8Zf8oyAH5NMslMEwjrM8e+2GecTWaead0yYN/oXpr/sGW3tKKuSMLIslZeg== X-Received: by 10.107.11.148 with SMTP id 20mr6170642iol.111.1457646449466; Thu, 10 Mar 2016 13:47:29 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104554 On Thu, Mar 10, 2016 at 2:33 PM, Fillmore wrote: > > when I put a Python script in pipe with other commands, it will refuse to > let go silently. Any way I can avoid this? What is your script doing? I don't see this problem. ikelly@queso:~ $ cat somescript.py import sys for i in range(20): sys.stdout.write('line %d\n' % i) ikelly@queso:~ $ python somescript.py | head -5 line 0 line 1 line 2 line 3 line 4 ikelly@queso:~ $ python3 somescript.py | head -5 line 0 line 1 line 2 line 3 line 4