Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.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: 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; 'subject:error': 0.03; 'interpreter': 0.05; 'explicit': 0.07; 'python3': 0.07; 'decorator': 0.09; 'parameter': 0.09; 'received:151': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'shame': 0.09; 'python': 0.11; 'def': 0.12; 'bug': 0.12; '**kwargs)': 0.16; '**kwargs):': 0.16; 'argument:': 0.16; 'positional': 0.16; 'received:80.91.229.3': 0.16; 'received:net24.it': 0.16; 'received:plane.gmane.org': 0.16; 'typeerror:': 0.16; 'wraps': 0.16; 'trying': 0.19; 'feb': 0.22; '>>>': 0.22; 'code,': 0.22; 'import': 0.22; 'saying': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'pass': 0.26; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; "doesn't": 0.30; 'forgot': 0.30; 'returned': 0.30; 'said,': 0.30; '"",': 0.31; 'convenience': 0.31; 'doc': 0.31; 'file': 0.32; 'this.': 0.32; 'linux': 0.33; '(most': 0.33; 'totally': 0.33; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'useful': 0.36; 'subject:?': 0.36; 'should': 0.36; 'half': 0.37; 'received:it': 0.37; 'so,': 0.37; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'read': 0.60; 'tell': 0.60; 'lost': 0.61; 'first': 0.61; 'subject:more': 0.64; 'more': 0.64; 'minutes': 0.67; 'hour': 0.70; 'applying': 0.72; 'carefully': 0.74; '2013,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Vito De Tullio Subject: a little more explicative error message? Date: Tue, 16 Jul 2013 07:44:45 +0200 Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: adsl-ull-143-217.50-151.net24.it User-Agent: KNode/4.10.5 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373953503 news.xs4all.nl 15976 [2001:888:2000:d::a6]:34949 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50726 Hi I was writing a decorator and lost half an hour for a stupid bug in my code, but honestly the error the python interpreter returned to me doesn't helped... $ python3 Python 3.3.0 (default, Feb 24 2013, 09:34:27) [GCC 4.7.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from functools import wraps >>> def dec(fun): ... @wraps ... def ret(*args, **kwargs): ... return fun(*args, **kwargs) ... return ret ... >>> @dec ... def fun(): pass ... >>> fun() Traceback (most recent call last): File "", line 1, in TypeError: update_wrapper() missing 1 required positional argument: 'wrapper' >>> $ Soo... at a first glance, no tricks... can you tell where is the error? :D As I said, the error is totally mine, I just forgot to pass the function as parameter to wraps. But... what is "update_wrapper()"? and "wrapper"? There is no useful traceback or something... just... this. Ok, the documentation clearly says: This is a convenience function to simplify applying partial() to update_wrapper(). So, again, shame on me... I just read carefully the doc *after* 20 minutes trying everything else... still... I think should be useful if wraps() intercept this error saying something more explicit about the missing fun parameter... -- ZeD