[Bug 384602] Re: dbshelve.py throws exception: AttributeError: 'DB' object has no attribute '__iter__'

dino99 384602 at bugs.launchpad.net
Sun May 3 13:24:23 UTC 2015


Support for this version has ended

** Changed in: python2.6 (Ubuntu)
       Status: Confirmed => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python2.6 in Ubuntu.
https://bugs.launchpad.net/bugs/384602

Title:
  dbshelve.py throws exception: AttributeError: 'DB' object has no
  attribute '__iter__'

Status in Python:
  Fix Released
Status in python2.6 package in Ubuntu:
  Invalid

Bug description:
  Binary package hint: python2.6

  In Python 2.6, the dbshelve.py module throws an AttributeError
  exception whenever a call is made to a method that depends upon an
  __iter__ method.  The exception is:

    File "/usr/lib/python2.6/bsddb/dbshelve.py", line 167, in __iter__
      return self.db.__iter__()
  AttributeError: 'DB' object has no attribute '__iter__'

  This means that, if mydb is an istance of a DB object, the following
  examples will fail:

      for key in mydb: print key
   
      print (k for k in mydb.iterkeys())

      for k, d in mydb.itervalues(): print k, d

  and many other statements depending on iterable(mydb) being true

  Note that, in Python 2.5, these examples work and no exception is
  thrown.  In fact, if you have both 2.5 and 2.6 installed on the same
  system, you can run the same program containing code as above with
  Python2.5 without issue while running it under Python 2.6 raises the
  exception seen above.

  Python Version:

  $ apt-cache policy python2.6
  python2.6:
    Installed: 2.6.2-0ubuntu1
    Candidate: 2.6.2-0ubuntu1
    Version table:
   *** 2.6.2-0ubuntu1 0
          500 http://archive.ubuntu.com jaunty/main Packages
          100 /var/lib/dpkg/status

  Ubuntu version:
  $ lsb_release -rd
  Description:	Ubuntu 9.04
  Release:	9.04

  Expected: Python program using dbshelve.py will work without
  modification under Python versions 2.5 and 2.6

  Actual: Python program works under Python2.5 but raises exception
  under Python 2.6

To manage notifications about this bug go to:
https://bugs.launchpad.net/python/+bug/384602/+subscriptions



More information about the foundations-bugs mailing list