Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-306

Exception with UUID after cursor.next()

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Works as Designed
    • 2.1
    • None
    • None
    • Ubuntu 11.04

    Description

      When I call .next() on a cursor I get this exception:

      Traceback (most recent call last):
      File "converter.py", line 26, in <module>
      data = mi.next()
      File "mongo/MongoInterface.py", line 31, in next
      out = self.cur.next();
      File "build/bdist.linux-x86_64/egg/pymongo/cursor.py", line 699, in next
      File "build/bdist.linux-x86_64/egg/pymongo/cursor.py", line 662, in _refresh
      File "build/bdist.linux-x86_64/egg/pymongo/cursor.py", line 624, in __send_message
      File "build/bdist.linux-x86_64/egg/pymongo/helpers.py", line 106, in _unpack_response
      File "build/bdist.linux-x86_64/egg/bson/_init_.py", line 439, in decode_all

      File "build/bdist.linux-x86_64/egg/bson/_init_.py", line 263, in _elements_to_dict

      File "build/bdist.linux-x86_64/egg/bson/_init_.py", line 254, in _element_to_dict

      File "build/bdist.linux-x86_64/egg/bson/_init_.py", line 148, in _get_binary

      File "/usr/lib/python2.7/uuid.py", line 144, in _init_
      raise ValueError('bytes is not a 16-char string')
      ValueError: bytes is not a 16-char string

      Here is the relevant code:

      cur = mongo_db.rawdata.find(timeout=False).sort('_id',1)
      out = cur.next();

      If I run mongo and do
      db.rawdata.find().sort({'_id',1})
      I get:

      > db.rawdata.find().sort({'_id':1})
      { "_id" : ObjectId("4eeefc0bad1519557b0005f2"), "timestamp" : NumberLong("1324284939632"), "data" : BinData(40,"Vz03MC45MCxWPTExOC40MCxBPTAuNjIsUEY9MC45NCxmPTYwLjAwCg=="), "address" : "::ffff:141.212.110.153" }
      { "_id" : ObjectId("4eeefc0cad1519557b0005f3"), "timestamp" : NumberLong("1324284940632"), "data" : BinData(40,"Vz03MC45MCxWPTExOC41MCxBPTAuNjMsUEY9MC45NSxmPTYwLjAwCg=="), "address" : "::ffff:141.212.110.153" }
      { "_id" : ObjectId("4eeefc0dad1519557b0005f4"), "timestamp" : NumberLong("1324284941389"), "data" : BinData(2,"AgAAAFGU"), "address" : "2607:f018:8000:bbba:12:6d45:507f:aa9e" }
      { "_id" : ObjectId("4eeefc0dad1519557b0005f5"), "timestamp" : NumberLong("1324284941632"), "data" : BinData(40,"Vz03MC45MCxWPTExOC41MCxBPTAuNjIsUEY9MC45NCxmPTYwLjAwCg=="), "address" : "::ffff:141.212.110.153" }
      { "_id" : ObjectId("4eeefc0ead1519557b0005f6"), "timestamp" : NumberLong("1324284942631"), "data" : BinData(40,"Vz03MC45MCxWPTExOC40MCxBPTAuNjUsUEY9MC45NSxmPTYwLjAwCg=="), "address" : "::ffff:141.212.110.153" }

      I can't tell what is different about this data, it looks like all of my other records.

      Attachments

        Activity

          People

            bernie@mongodb.com Bernie Hackett
            bradjc Brad Campbell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: