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


Groups > comp.lang.python > #104565

Re: Other difference with Perl: Python scripts in a pipe

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From INADA Naoki <songofacandy@gmail.com>
Newsgroups comp.lang.python
Subject Re: Other difference with Perl: Python scripts in a pipe
Date Fri, 11 Mar 2016 09:08:55 +0900
Lines 30
Message-ID <mailman.161.1457654957.15725.python-list@python.org> (permalink)
References <nbsp83$2p1$1@gioia.aioe.org> <CALwzidk+8mf-nxFHtsEH+1j8wFSLPNuBtfF64kgFoy2ztWqa1Q@mail.gmail.com> <nbsral$vpa$1@ger.gmane.org> <mailman.159.1457648213.15725.python-list@python.org> <nbt14l$e87$1@gioia.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de iqp1fIgVi5iphUoS5o2aZA9sbJ04b2mvmn4gs+5ywdiQ==
Return-Path <songofacandy@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.05; 'exception.': 0.07; 'cc:addr:python-list': 0.09; 'python': 0.10; 'explicitly': 0.15; '2016': 0.16; 'email addr:hotmail.com&gt;': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'swallow': 0.16; 'usually.': 0.16; 'wrote:': 0.16; "shouldn't": 0.18; 'try:': 0.18; '&gt;': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'pass': 0.22; 'am,': 0.23; 'errors': 0.23; "python's": 0.23; 'header:In-Reply-To:1': 0.24; 'url:bugs': 0.24; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'command-line': 0.29; 'received:209.85.213.174': 0.29; 'silence': 0.29; 'raise': 0.29; "i'm": 0.30; 'probably': 0.31; 'changed': 0.33; 'url:python': 0.33; 'except': 0.34; 'received:google.com': 0.35; 'skip:p 30': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'possible': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'seem': 0.37; 'received:209': 0.38; 'sure': 0.39; 'does': 0.39; 'subject:with': 0.40; 'behavior': 0.61; 'no.': 0.62; 'mar': 0.65; 'worth': 0.67; 'zen': 0.84; 'hassle': 0.91; 'interesting,': 0.93; 'to:addr:hotmail.com': 0.98
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 :cc; bh=XFhzlniFotLAcMBRAWE5FNkYF+V/0yhWiq47tlWn5EU=; b=ewfj2/T4r7z0HM01yAd1cXahtURkMoIMW1XaoRTKC+zdylIhmw9qSFgD14WNQtaedT U/KbCr7C4BrWqjYCna/ssDJKYRe3/j+dSq3TzyKGer3YRTydeuTYDt5gYDuZaDKrrkBA 1lNH6+QZpDhhEGAOK/UzqEo99wASu4QB0+5G8DCOGZGBl/1jpk/RWBfTAygnhD7HJDqT ZBI8liYYMK3MVIH7brTFIG0KDuc91Xy0GyISjIHBUAJVkaBTBHsfEwX7b253vlnfwMzZ 1gFXtmoHL0DrWKoo11ekGfjjZooM/haJ8533jyqbPySdNEAGdSIZyKksb7Myjq52mOsB +xUw==
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:cc; bh=XFhzlniFotLAcMBRAWE5FNkYF+V/0yhWiq47tlWn5EU=; b=VmQcz7ONNATyGwMfaoZ8RDDJwIlytZv8wuu3webLyXA/L8HMhjWjofKPHdfuLa8qRX 0BlGW6BBq26d2C6K23YCx3Xwr3NzQ9+pNcwuraTUuZDKly/zh80Aaweg32qvSvcutvJW XiE/+cr3O4bG9MfLBscxcU41+2rCNiu3eTphJmxiMv4imoGTvYnNFjF9vNJ+eSWQWW3Z DmDmcU+uXHIIPf+hUIITLs9bcvWKgNOHdjcYkxOOQX7hRwJvWHhtjSrJ2ZAJhBJPhBFH qLDJqLvxEZpMAkac7xtDfmz/5DokLkk8ByHGLh4IioqnMhp9/iOZL8yWqzpEPJskoDAW wNmQ==
X-Gm-Message-State AD7BkJKNhWr065s0oS/1QjgyJzgvvYqsxCBDq7XJhZF6nM//Z0/iL44vuJz5bzN56xzD5RxxPbos3lZn3OxPoA==
X-Received by 10.50.66.179 with SMTP id g19mr69911igt.4.1457654955317; Thu, 10 Mar 2016 16:09:15 -0800 (PST)
In-Reply-To <nbt14l$e87$1@gioia.aioe.org>
X-Content-Filtered-By Mailman/MimeDel 2.1.21
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
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>
Xref csiph.com comp.lang.python:104565

Show key headers only | View raw


On Fri, Mar 11, 2016 at 8:48 AM, Fillmore <fillmore_remove@hotmail.com>
wrote:

> On 3/10/2016 5:16 PM, Ian Kelly wrote:
>
>>
>> Interesting, both of these are probably worth bringing up as issues on
>> the bugs.python.org tracker. I'm not sure that the behavior should be
>> changed (if we get an error, we shouldn't just swallow it) but it does
>> seem like a significant hassle for writing command-line
>> text-processing tools.
>>
>
> is it possible that I am the first one encountering this kind of issues?
>
>
No.  I see it usually.

Python's zen says:

> Errors should never pass silently.
>    Unless explicitly silenced.

When failed to write to stdout, Python should raise Exception.
You can silence explicitly when it's safe:

try:
    print(...)
except BrokenPipeError:
    os.exit(0)

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


Thread

Other difference with Perl: Python scripts in a pipe Fillmore <fillmore_remove@hotmail.com> - 2016-03-10 16:33 -0500
  Re: Other difference with Perl: Python scripts in a pipe Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-10 14:46 -0700
    Re: Other difference with Perl: Python scripts in a pipe Fillmore <fillmore_remove@hotmail.com> - 2016-03-10 17:04 -0500
  Re: Other difference with Perl: Python scripts in a pipe Peter Otten <__peter__@web.de> - 2016-03-10 23:09 +0100
  Re: Other difference with Perl: Python scripts in a pipe Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-10 15:16 -0700
    Re: Other difference with Perl: Python scripts in a pipe Fillmore <fillmore_remove@hotmail.com> - 2016-03-10 18:48 -0500
      Re: Other difference with Perl: Python scripts in a pipe INADA Naoki <songofacandy@gmail.com> - 2016-03-11 09:08 +0900
        Re: Other difference with Perl: Python scripts in a pipe Fillmore <fillmore_remove@hotmail.com> - 2016-03-10 19:26 -0500
          Re: Other difference with Perl: Python scripts in a pipe Alan Bawden <alan@csail.mit.edu> - 2016-03-11 01:45 -0500
            Re: Other difference with Perl: Python scripts in a pipe Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-03-11 12:15 +0200
          Re: Other difference with Perl: Python scripts in a pipe Ethan Furman <ethan@stoneleaf.us> - 2016-03-11 00:55 -0800

csiph-web