Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24864
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <andrea.crotti.0@gmail.com> |
| 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; 'exception': 0.03; 'value,': 0.03; 'result,': 0.05; 'sys': 0.05; '__name__': 0.07; 'shutil': 0.07; 'subject:adding': 0.07; 'suppose': 0.07; 'exception,': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; "'__main__':": 0.16; 'quits': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'bit': 0.21; 'import': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'machine': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'creating': 0.26; 'first,': 0.27; 'reaches': 0.27; 'message- id:@mail.gmail.com': 0.27; "i'm": 0.29; 'maybe': 0.29; 'error': 0.30; 'received:google.com': 0.34; 'continue': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; "i'll": 0.36; 'should': 0.36; 'problems': 0.36; 'option': 0.37; 'virtual': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'header:Received:5': 0.40; 'think': 0.40; 'easy': 0.60; 'solve': 0.62; 'generations,': 0.84; 'subject:mode': 0.84; 'demand': 0.96 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Bj7ObGJQGfq1RpPk2b8HuETCiVx6ZYc1REAstRv2Lxc=; b=L7njny0YpS2RN6CYtP1vVq5uE1urnmwgbWRSqzfa+7v2UlklX/IeIKnfwrrhfdSi6j F82xO/McPLUMAGRBKp1utzt78KWrRsRVaVmGEOokIsD73cusIruFKzfLJ8p3KHt+aP9u za8Rd+H/C78fzIX6oOyL1t8yT4zac60boljVumTen9da29iwEe9WDl3Tj7KY5MvNXoCN p5kCCquacmUa/D7LLJJlDlKO6x8Il/1oU/lgKxgGLit49oyoN9kq2M4pY0B8iRhydbfq wr0e/2/h36Z4GJEVqqp1sQjCIL7rFSxd7TIAD4cukr+dj0bWxQgrfwNK3beHXfwjr/d3 lBPg== |
| MIME-Version | 1.0 |
| In-Reply-To | <CAF_E5JbDfND7g0fjqBdxJsVXwLAZLFmiXYd+GpD2_OTPWTXobQ@mail.gmail.com> |
| References | <mailman.1786.1341394979.4697.python-list@python.org> <4ff44823$0$29988$c3e8da3$5496439d@news.astraweb.com> <CAF_E5JbDfND7g0fjqBdxJsVXwLAZLFmiXYd+GpD2_OTPWTXobQ@mail.gmail.com> |
| Date | Wed, 4 Jul 2012 15:19:15 +0100 |
| Subject | Re: adding a simulation mode |
| From | andrea crotti <andrea.crotti.0@gmail.com> |
| To | "Steven D'Aprano" <steve+comp.lang.python@pearwood.info> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1792.1341411557.4697.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1341411557 news.xs4all.nl 6897 [2001:888:2000:d::a6]:54453 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:24864 |
Show key headers only | View raw
> Yes there is no easy solution apparently.. But I'm also playing
> around with vagrant and virtual machine generations, suppose I'm able
> to really control what will be on the machine at time X, creating it
> on demand with what I need, it might be a good way to solve my
> problems (a bit overkill and slow maybe though).
>
> I'll try the sys.excepthook trick first, any error should give me an
> exception, so if I catch them all I think it might work already..
I actually thought that the sys.excepthook would be easy but it's not
so trivial apparently:
This simple sample never reaches the print("here"), because even if
the exception is catched it still quits with return code=1.
I also tried to catch the signal but same result, how do I make it
continue and just don't complain?
The other option if of course to do a big try/except, but I would
prefer the excepthook solution..
import sys
from shutil import copy
def my_except_hook(etype, value, tb):
print("got an exception of type", etype)
if __name__ == '__main__':
sys.excepthook = my_except_hook
copy('sdflsdk')
print("here")
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
adding a simulation mode andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-04 10:42 +0100
Re: adding a simulation mode Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-04 13:41 +0000
Re: adding a simulation mode andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-04 14:59 +0100
Re: adding a simulation mode andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-04 15:19 +0100
Re: adding a simulation mode Paul Rubin <no.email@nospam.invalid> - 2012-07-04 10:01 -0700
csiph-web