Newbie question 2

Rob talon2lm at yahoo.com
Sun Nov 9 18:26:47 EST 2003


Gentlemen,

    Thanks so much..I do appreciate it. I'm finding that this newsgroup, its
members,  is a wealth of knowledge. My next assignment is to use the TKinter
GUI stuff...so far, so good but I'm sure you'll be hearing more from me!

Thanks,
Rob

"Rob" <talon2lm at yahoo.com> wrote in message
news:Bf6dnT_Ctq5FCTCiRVn-hA at comcast.com...
> Ok, my two problems for this program that I can't seem to get are...
>
> 1)Why won't the program let me delete an entry after just entering it? If
I
> run the program, add an entry then quit, then restart the program it will
> let me delete it. Otherwise it won't see it...Am I missing something???
>
> 2)In the dele function I'm trying to add exceptions. The problem is if I
try
> to delete an entry that doesn't exist it will give me this error:
>
> Traceback (most recent call last):
> File "C:\Python23\phone.py", line 118, in -toplevel-
>     dele(dn,dp)
>   File "C:\Python23\phone.py", line 67, in dele
>     del e[str(f)]
>   File "C:\Python23\lib\shelve.py", line 133, in __delitem__
>     del self.dict[key]
>   File "C:\Python23\lib\bsddb\__init__.py", line 94, in __delitem__
>     del self.db[key]
> DBNotFoundError: (-30991, 'DB_NOTFOUND: No matching key/data pair found')
>
> Ok great...so I try to add the DBNotFoundError in my Except() only it
tells
> me:
>
> Traceback (most recent call last):
>   File "C:\Python23\phone.py", line 118, in -toplevel-
>     dele(dn,dp)
>   File "C:\Python23\phone.py", line 70, in dele
>     except (DBNotFoundError, NameError):
> NameError: global name 'DBNotFoundError' is not defined
>
> How can it give me an error and then not allow me to enter that error in
my
> Except()?
>
> Thanks for your help!
>
>
>






More information about the Python-list mailing list