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


Groups > comp.lang.python > #100147 > unrolled thread

Re: storing test logs under /var/log/

Started byPeter Otten <__peter__@web.de>
First post2015-12-08 13:24 +0100
Last post2015-12-08 13:24 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#100147 — Re: storing test logs under /var/log/

FromPeter Otten <__peter__@web.de>
Date2015-12-08 13:24 +0100
SubjectRe: storing test logs under /var/log/
Message-ID<mailman.57.1449577502.12405.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web