From: inhahe on 29 Dec 2009 21:30 On Tue, Dec 29, 2009 at 6:38 PM, Irmen de Jong <irmen-NOSPAM-(a)xs4all.nl> wrote: > On 29-12-2009 23:22, inhahe wrote: > > inspect.getargvalues is used on frames, not on regular code objects. > Maybe you were looking for inspect.getargspec? > That explains it! I knew I'd done this before, I was just looking at the wrong function name. thx
From: Lie Ryan on 30 Dec 2009 23:11 On 12/30/2009 9:10 AM, inhahe wrote: > Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> import inspect >>>> def a(b=1): pass > .... >>>> inspect.getargvalues(a) > Traceback (most recent call last): > File "<stdin>", line 1, in<module> > File "C:\Python26\lib\inspect.py", line 816, in getargvalues > args, varargs, varkw = getargs(frame.f_code) > AttributeError: 'function' object has no attribute 'f_code' >>>> dir(a) > ['__call__', '__class__', '__closure__', '__code__', '__defaults__', '__delattr_ > _', '__dict__', '__doc__', '__format__', '__get__', '__getattribute__', '__globa > ls__', '__hash__', '__init__', '__module__', '__name__', '__new__', '__reduce__' > , '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subcla > sshook__', 'func_closure', 'func_code', 'func_defaults', 'func_dict', 'func_doc' > , 'func_globals', 'func_name'] >>>> > > So i'm guessing that the attribute has been changed from func_code to > f_code but the inspect module wasn't updated to reflect that. No, that wasn't the case. The argument of inspect.getargvalues() is a 'frame object' not 'function object'. e.g.: >>> inspect.getargvalues(inspect.currentframe()) You could argue that the error message is misleading (should be TypeError instead), do you want a bug report on that?
From: Ron Croonenberg on 31 Dec 2009 00:24 hello, is there a way, in python, to create a splash window and when the program has completed disappears by sending a msg to it? (I tried creating two gtk windows but gtk_main doesn't seem to return unless it gets closed.) tia Ron
First
|
Prev
|
Pages: 1 2 Prev: [ANN] Pyspread 0.0.13 released Next: How to test a URL request in a "while True" loop |