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


Groups > comp.lang.python > #100147

Re: storing test logs under /var/log/

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: storing test logs under /var/log/
Date Tue, 08 Dec 2015 13:24:54 +0100
Organization None
Lines 33
Message-ID <mailman.57.1449577502.12405.python-list@python.org> (permalink)
References <CACT3xuUafZ8Ga4WyLvRLHu0JYkp3cPBBeOUZo0sWazmcEGC-gw@mail.gmail.com> <20151203081723.GA48121@cskk.homeip.net> <CACT3xuVBeggf9scJMjgA1HT+P7AEp-x5GZBwGnzpq7_XQg7dUg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace news.uni-berlin.de J1JUfWElDY+EUspxr7lWJg0+cE1BF+ieNAgUZdCXJHkw==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; '"""': 0.05; 'defaults': 0.05; 'none,': 0.05; 'sys': 0.05; 'exit': 0.07; 'subject:test': 0.07; 'integer,': 0.09; 'objects:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'interpreter': 0.15; 'afterwards': 0.16; 'argument.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'status.': 0.16; 'subject:log': 0.16; 'subject:under': 0.16; 'wrote:': 0.16; 'string': 0.17; 'numerical': 0.18; 'module': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'error': 0.27; 'object,': 0.27; 'function': 0.28; 'accepts': 0.29; 'invoke': 0.29; 'omitted': 0.29; 'subject:/': 0.30; 'code': 0.30; '(i.e.,': 0.30; 'probably': 0.31; 'another': 0.32; 'displayed': 0.33; 'raising': 0.33; 'similar': 0.33; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'display': 0.37; 'received:org': 0.37; 'wrong': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'side': 0.62; 'cameron': 0.66; 'message")': 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host p57bd9c0c.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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:100147

Show key headers only | View raw


Ganesh Pal wrote:

[Cameron Simpson:]

>> Finally. sys.exit accepts an integer, not a string.

> Most of code  uses sys.exit("some error message")   ,  I did notice
> that the error message is not displayed by sys .exit("some error
> message") ,  do  u mean that using string is not advisable with
> sys.exit ?

Cameron is wrong (he's probably coming from the C side of things). 
You can invoke sys.exit() with arbitrary objects:

"""
Help on built-in function exit in module sys:

exit(...)
    exit([status])
    
    Exit the interpreter by raising SystemExit(status).
    If the status is omitted or None, it defaults to zero (i.e., success).
    If the status is an integer, it will be used as the system exit status.
    If it is another kind of object, it will be printed and the system
    exit status will be one (i.e., failure).
"""

> How to I display error messages with sys.exit then ?

Wrong question; if you want to use sys.exit() in a way similar to C display 
the error message first and invoke sys.exit() afterwards with a numerical 
argument.

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


Thread

Re: storing test logs under /var/log/ Peter Otten <__peter__@web.de> - 2015-12-08 13:24 +0100

csiph-web