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.
er i mean from f_code to func_code
f_locals doesn't even seem to exist at all.
Traceback (most recent call last):
File "E:\jsterm\specs\test.py", line 6, in <module>
print inspect.getargvalues(a)
File "E:\Python26\lib\inspect.py", line 817, in getargvalues
return ArgInfo(args, varargs, varkw, frame.f_locals)
AttributeError: 'function' object has no attribute 'f_locals
>>> dir(a)
['__call__', '__class__', '__closure__', '__code__', '__defaults__',
'__delattr__', '__dict__', '__doc__', '__format__', '__get__',
Please read the documentation for inspect.getargvalues:
"""
inspect.getargvalues(frame)
Get information about arguments passed into a particular frame. A
tuple of four things is returned: (args, varargs, varkw, locals). args
is a list of the argument names (it may contain nested lists). varargs
and varkw are the names of the * and ** arguments or None. locals is
the locals dictionary of the given frame.
Changed in version 2.6: Returns a named tuple ArgInfo(args,
varargs, keywords, locals).
"""
HTH,
Daniel
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
[...]
I think there are 2 different things :
f_code : 'the code object being executed in this frame'
func_code : 'The code object representing the compiled function'
That is, one is valid in the context of execution stack frames,
while the other is valid in the context of compiled byte code objects
that are generated for functions and so on.
inspect.getargvalues is used on frames, not on regular code objects.
Maybe you were looking for inspect.getargspec?
-irmen
That explains it!
I knew I'd done this before, I was just looking at the wrong function name. thx
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?
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
*****
hello,
tia
Ron
*****
wxPython has a splash page "widget" for this sort of thing. Of course,
if all you want to do is display a message to the user for a short
time, any GUI library will allow you to create a window of some sort
that you can use for that purpose. Note that GUI's tend to run in a
loop that may block your calling program, so you may need to mess with
threads, in which case each GUI has their own thread-safe methods.
It's less complicated then it sounds. I tend to use wxPython the most,
so if you have specific questions about that, let me know. Good luck!
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
PyCon 2010 Atlanta Feb 19-21 http://us.pycon.org/
> 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.)
It's really simple to do this in Dabo (which uses wxPython under the
hood, but is _so_ much more elegant!). When you create your app, add
the following two parameters:
app = dabo.dApp(showSplashScreen=True, splashImage="/path/to/splash.png")
That's it!
--
# p.d.