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


Groups > comp.lang.python > #71503

Exception problem with module

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jcasale@activenetwerx.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'assignment': 0.07; 'odd': 0.07; 'exception,': 0.09; 'happen?': 0.09; 'raises': 0.09; 'subject:module': 0.09; 'works.': 0.09; 'suggest': 0.14; 'args.': 0.16; 'exception:': 0.16; 'imports': 0.16; 'received:172.18.0': 0.16; 'subclasses': 0.16; 'typeerror:': 0.16; 'exception': 0.16; 'obviously': 0.18; 'module': 0.19; 'passing': 0.19; 'module,': 0.24; 'subject:problem': 0.24; 'header:Received:8': 0.24; 'handling': 0.26; 'code': 0.31; 'catching': 0.31; 'file': 0.32; 'another': 0.32; 'cases': 0.33; 'subject:with': 0.35; 'classes': 0.35; 'except': 0.35; 'something': 0.35; 'but': 0.35; 'done': 0.36; 'charset:us-ascii': 0.36; 'so,': 0.37; 'to:addr:python- list': 0.38; '12,': 0.39; 'to:addr:python.org': 0.39; 'catch': 0.60; 'received:unknown': 0.61; 'new': 0.61; 'back': 0.62
X-Cloudmark-SP-Filtered true
X-Cloudmark-SP-Result v=1.1 cv=OwXf4AQYS7J10u4+/2kpCX1VHJ+qeA/E1g375LKBsDQ= c=1 sm=1 a=7PYXob_7ZXMA:10 a=P90J6pEA2ccA:10 a=BLceEmwcHowA:10 a=kj9zAlcOel0A:10 a=xqWC_Br6kY4A:10 a=oNw28mxuUhXRB3mVwYQ4Ag==:17 a=J9xtMBLOfnTyqgctOvgA:9 a=CjuIK1q_8ugA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=activenetwerx.com; s=default; t=1400000438; bh=JWYh1fQieXhGhuL/HWf79Pt7w0qX/ajY0meWSY523Ys=; h=From:To:Subject:Date; b=E6gWoHb+xplzZibkwL7/YohgnzNhfioIbQtVBDSNZdPuISU4GTbUHb70DHIJ+QomH qQ00jprkNmFbnswRA111xMmxKFT7GOY+5ecNIVC2942CPMAtByEhhavr2gpaFzmanc G2wLWDP9/Ir5lPoglXKCIPdSLPkN86Wzf5pVJ/MI=
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=activenetwerx.com; s=default; t=1400000438; bh=JWYh1fQieXhGhuL/HWf79Pt7w0qX/ajY0meWSY523Ys=; h=From:To:Subject:Date; b=E6gWoHb+xplzZibkwL7/YohgnzNhfioIbQtVBDSNZdPuISU4GTbUHb70DHIJ+QomH qQ00jprkNmFbnswRA111xMmxKFT7GOY+5ecNIVC2942CPMAtByEhhavr2gpaFzmanc G2wLWDP9/Ir5lPoglXKCIPdSLPkN86Wzf5pVJ/MI=
X-Spam-Checker-Version SpamAssassin 3.3.1 (2010-03-16) on mail.activenetwerx.com
X-Spam-Level
X-Spam-Status No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham version=3.3.1
From "Joseph L. Casale" <jcasale@activenetwerx.com>
To Python <python-list@python.org>
Subject Exception problem with module
Thread-Topic Exception problem with module
Thread-Index AQHPbsriLeIN+SWW90mOr8A0k8UUzw==
Date Tue, 13 May 2014 16:59:46 +0000
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [172.18.0.4]
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-Virus-Scanned ClamAV using ClamSMTP
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.9975.1400000510.18130.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1400000510 news.xs4all.nl 2888 [2001:888:2000:d::a6]:35542
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:71503

Show key headers only | View raw


I am working with a module that I am seeing some odd behavior.

A module.foo builds a custom exception, module.foo.MyError, its done right
afaict.

Another module, module.bar imports this and calls bar.__setattr__('a_new_name', MyError).

Now, not in all but in some cases when I catch a_new_name, my code raises a new
exception:

During handling of the above exception, another exception occurred:

  File "C:/dir/test.py", line 12, in <module>
    except a_new_name as exc:
TypeError: catching classes that do not inherit from BaseException is not allowed

So, I wont suggest the assignment in bar added anything, nor would I do this, but
its what I am working with. Why might this happen? MyError subclasses Exception
and calls super passing back args.

This has something to do with the assignment in bar, catching MyError obviously works.

Any ideas?
jlc

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


Thread

Exception problem with module "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-05-13 16:59 +0000
  Re: Exception problem with module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-14 00:02 +0000
    RE: Exception problem with module "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-05-14 09:21 +0000
      Re: Exception problem with module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-14 13:08 +0000
        Re: Exception problem with module Chris Angelico <rosuav@gmail.com> - 2014-05-14 23:17 +1000
        RE: Exception problem with module "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-05-19 23:48 +0000

csiph-web