I think I found a bug in Python 2.6.4 (in the inspect module)

I

inhahe

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.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'['__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.
 
L

Lie Ryan

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.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'['__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.:
You could argue that the error message is misleading (should be
TypeError instead), do you want a bug report on that?
 
R

Ron Croonenberg

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
 
R

Ron Croonenberg

sorry about posting with the wrong subject...

*****
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
*****
 
M

Mike Driscoll

sorry about posting with the wrong subject...

*****
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
*****

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/
 
P

Peter Decker

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top