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

Error (bson.errors.InvalidBSON) when trying to authenticate to mongodb with python/pymongo

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: None
    • Environment:
      Debian 6.0, Python 2.6.6 (default), Hardware: ARMEL Processor Feroceon 88FR131 1.2GHz (SheevaPlug).

      Description

      I am trying to authenticate to a mongodb database (from mongolab) using python 2.6.6 and pymongo 2.1.1 in a Debian 6.0 system.

      >>> con=pymongo.Connection('xxx.mongolab.com', 31567)
      >>> con.db.authenticate('abc', 'def')

      Traceback (most recent call last):
      File "", line 1, in
      File "/usr/local/lib/python2.6/dist-packages/pymongo/database.py", line 620, in authenticate
      nonce = self.command("getnonce")["nonce"]
      File "/usr/local/lib/python2.6/dist-packages/pymongo/database.py", line 348, in command
      result = self["$cmd"].find_one(command, **extra_opts)
      File "/usr/local/lib/python2.6/dist-packages/pymongo/collection.py", line 520, in find_one
      for result in self.find(spec_or_id, *args, **kwargs).limit(-1):
      File "/usr/local/lib/python2.6/dist-packages/pymongo/cursor.py", line 703, in next
      if len(self.__data) or self._refresh():
      File "/usr/local/lib/python2.6/dist-packages/pymongo/cursor.py", line 666, in _refresh
      self.__uuid_subtype))
      File "/usr/local/lib/python2.6/dist-packages/pymongo/cursor.py", line 628, in __send_message
      self.__tz_aware)
      File "/usr/local/lib/python2.6/dist-packages/pymongo/helpers.py", line 107, in _unpack_response
      result["data"] = bson.decode_all(response[20:], as_class, tz_aware)
      bson.errors.InvalidBSON

      Exactly the same code is working in a Windows XP system with also pymongo 2.1.1 but with python 2.7.2.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: