On Sun, 17 Apr 2016 02:09 am, Dennis Lee Bieber wrote:
> VMS had a whole slew of "no error" status values (essentially all
> positive odd integers were "success", but different values carried
> additional information.
1 = success
3 = success against all odds
5 = success but at great cost
7 = su
Dennis Lee Bieber writes:
> On Sat, 16 Apr 2016 16:56:10 +1000, Ben Finney
> declaimed the following:
>
> >It seems strange that even the constant for “no error” exit status
> >should be defined only for Unix :-/
>
> VMS had a whole slew of "no error" status values
That's fine; those valu
On Sat, Apr 16, 2016 at 4:56 PM, Ben Finney wrote:
> Stephen Hansen writes:
>
>> > * You can use named constants from ‘os’ for the purpose of specifying
>> > exit status numbers.
>>
>> Only on *nix.
>
> Hmm, I didn't see that. It seems strange that even the constant for “no
> error” exit status
Stephen Hansen writes:
> > * You can use named constants from ‘os’ for the purpose of specifying
> > exit status numbers.
>
> Only on *nix.
Hmm, I didn't see that. It seems strange that even the constant for “no
error” exit status should be defined only for Unix :-/
--
\ “Geeks like
> * You can use named constants from ‘os’ for the purpose of specifying
> exit status numbers.
Only on *nix.
Even then it varies from platform to platform which constants you can
use. I'd prefer to document the return status and use numbers/my own
constants directly, that way supporting any p
c...@zip.com.au writes:
> My preferred pattern is like this:
>
> def main(argv):
>try:
> ...
>except Exception as e:
> logging.exception(e)
> return 1
>
> if __name__ == '__main__':
>sys.exit(main(sys.argv))
>
> Notice that main() is back to being a normal function wit
On 12Apr2016 18:20, Ganesh Pal wrote:
I m on python 2.7 and Linux , I have a simple code need suggestion if I
I could replace sys.exit(1) with raise SystemExit .
==Actual code==
def main():
try:
create_logdir()
create_dataset()
unittest.main()
except Exception as
"Martin A. Brown" writes:
> The only change from what Ben suggests is that, once I found os.EX_OK,
> I just kept on using it, instead of difining my own EXIT_SUCCESS in
> every program.
Ah, thank you! I was unaware of the exit-status constants in ‘os’::
The following exit codes are defined
Hello all,
Apologies for this post which is fundamentally, a 'me too' post, but
I couldn't help but chime in here.
>This is good practice, putting the mainline code into a ‘main’
>function, and keeping the ‘if __name__ == '__main__'’ block small
>and obvious.
>
>What I prefer to do is to make
Ganesh Pal writes:
> I m on python 2.7 and Linux , I have a simple code need suggestion if I
> I could replace sys.exit(1) with raise SystemExit .
No, but you can replace::
sys.exit(1)
with::
raise SystemExit(1)
As you know from reading the ‘sys.exit’ documentation
https://docs.
On Tue, Apr 12, 2016, at 10:12, Ganesh Pal wrote:
> >
> >
> > No; raise SystemExit is equivalent to sys.exit(0); you would need raise
> > SystemExit(1) to return 1.
> >
>
> Thanks will replace SystemExit with SystemExit(1) .
>
>
>
> > Why do you want to do this, though? What do you think you ga
>
>
> No; raise SystemExit is equivalent to sys.exit(0); you would need raise
> SystemExit(1) to return 1.
>
Thanks will replace SystemExit with SystemExit(1) .
> Why do you want to do this, though? What do you think you gain from it?
>
Iam trying to have a single exit point for many function
On Tue, Apr 12, 2016, at 08:50, Ganesh Pal wrote:
> I m on python 2.7 and Linux , I have a simple code need suggestion if
> I
> I could replace sys.exit(1) with raise SystemExit .
No; raise SystemExit is equivalent to sys.exit(0); you would need raise
SystemExit(1) to return 1.
Why do you wa
I m on python 2.7 and Linux , I have a simple code need suggestion if I
I could replace sys.exit(1) with raise SystemExit .
==Actual code==
def main():
try:
create_logdir()
create_dataset()
unittest.main()
except Exception as e:
logging.exception(e)
14 matches
Mail list logo