[Tutor] python shell not working like it used to
jeffpeery at yahoo.com
Mon Feb 26 20:37:05 CET 2007
well the __init__() funciton is not my code, it is in:
as I mentioned I upgraded wxpython... maybe I should email there... anyhow I just want to use my dictionary in the shell, but I'm not sure what the attribute 'this' is... it seems to be something different from my previous version of wxpython.
Alan Gauld <alan.gauld at btinternet.com> wrote: "Jeff Peery" wrote
> def __init__(self, other):
> d['this'] = other.this
> "other" here is the dictionary I pass in (I think),
> so it's for some reason looking for some attribute in
> my dictionary called 'this'.
other is whatever you pass in.
The code expects it to be dictionary like and to
have a this attribute
> of course my dictionary doesn't have this attribute.
So why is your code trying to access one if you know
it doesn't exist? And why are you surprised at the
error message? (Or is the init() not your code?)
> I have no idea what this is. any ideas?
Youu seem to have answered your own question.
You are passing a dictionary into init() that does not
have a this attribute but the code inside the init() is
trying to access a this attribute. It can't find one so
it raises an error.
Either remove the this access in init or add a thus
attribute to your dictionary argument. Or pass an
argument that does have a this attribute.
I'm slightly confused about what you are asking us to tell you?
Author of the Learn to Program web site
Tutor maillist - Tutor at python.org
Everyone is raving about the all-new Yahoo! Mail beta.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor