Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Golden Newsgroups: comp.lang.python Subject: Re: How to get which attribute causes the AttributeError except inspecting strings? Date: Mon, 7 Mar 2016 16:38:09 +0000 Lines: 20 Message-ID: References: <7915b82e-12f4-4652-999e-a1cfaca717b6@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de SrmVowOCO7Pzylh7BAc+6Q+oCfnzI4KcTnb8pBBBr8ag== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'seemed': 0.07; 'subject:How': 0.09; 'chime': 0.09; 'issue:': 0.09; 'raised,': 0.09; 'subject:which': 0.09; 'exception': 0.13; 'subject: \n ': 0.15; "can't.": 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'message-id:@timgolden.me.uk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'tjg': 0.16; 'wrote:': 0.16; 'string': 0.17; 'attribute': 0.18; 'to:2**1': 0.21; 'seems': 0.23; 'header:In-Reply-To:1': 0.24; 'discussion': 0.24; 'url:bugs': 0.24; 'header:User-Agent:1': 0.26; 'inspect': 0.29; 'url:python': 0.33; 'raised': 0.33; 'involving': 0.35; 'but': 0.36; 'there': 0.36; 'url:org': 0.36; 'possible': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'things': 0.38; 'hi,': 0.38; 'subject:the': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'hope': 0.61; 'caused': 0.61; 'bring': 0.62; 'back': 0.62; 'charset:windows-1252': 0.62; 'subject:skip:A 10': 0.63; 'more': 0.63; 'interest': 0.64; 'forward': 0.66; 'life': 0.67; 'from:addr:mail': 0.70; 'directly.': 0.76; 'interest.': 0.79; 'introduce': 0.79; 'subject:get': 0.81; 'movement.': 0.84; 'revive': 0.84; 'zhang': 0.84 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 In-Reply-To: <7915b82e-12f4-4652-999e-a1cfaca717b6@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104225 On 07/03/2016 16:25, Xiang Zhang wrote: > Hi, > > I know I can get the attribute name in some way, but since I just > want the attribute name when an AttributeError caused by it raised, I > really don't want to inspect the string or introduce one more layer > over getattr. I hope I can get the attribute which causes the > exception from the AttributeError raised directly. But it seems I > can't. > As things stand, you can't. But if you were to chime in on this issue: https://bugs.python.org/issue18156 then you might bring discussion there back to life again and see some forward movement. There seemed to be a consensus (and involving some active developers) so it's possible that new interest might revive interest. TJG