Re: Error type for shelve.open()

2006-07-10 Thread aomighty
I reported the bug to python.org and apparently it has already been fixed in the latest SVN build :). [EMAIL PROTECTED] wrote: > Yes, the problem was that I hadn't imported anydbm.error... it's > working now. > > As for the AttributeError at the end, I talked to someone else, and he > looked at the

Re: Error type for shelve.open()

2006-07-07 Thread aomighty
Yes, the problem was that I hadn't imported anydbm.error... it's working now. As for the AttributeError at the end, I talked to someone else, and he looked at the source and said it was a bug in shelve. I think I will report it to python.org. Anyway, thanks :). Simon Forman wrote: > [EMAIL PROTEC

Re: Error type for shelve.open()

2006-07-05 Thread aomighty
I tried what you said and it looked like maybe AttributeError, but that didn't work either. This code snippet: import shelve from traceback import format_exc try: db = shelve.open("meh", "r") except: print format_exc() Gave me this output: Traceback (most recent call last): File "test.p

Error type for shelve.open()

2006-07-05 Thread aomighty
I wanted to write the following code: import shelve try: db = shelve.open(file, "r") except SomeError: print "Oh no, db not found" Only, I'm not sure what SomeError should be. I tried error, anydbm.error, shelve.open.anydb.error, etc. but can't find it. Things worked fine with simply except

Re: Speed up this code?

2006-05-25 Thread aomighty
I got it working using difference() and sets, thanks all! 100,000 takes about 3 times the time of 10,000, which is what my math buddies told me I should be getting, rather than an exponential increase :). Thanks, all! -- http://mail.python.org/mailman/listinfo/python-list

Speed up this code?

2006-05-25 Thread aomighty
I'm creating a program to calculate all primes numbers in a range of 0 to n, where n is whatever the user wants it to be. I've worked out the algorithm and it works perfectly and is pretty fast, but the one thing seriously slowing down the program is the following code: def rmlist(original, deleti