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

[PATCH] GridOutIterator.__init__ assumes grid_out.length can always be converted to float

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1
    • Affects Version/s: None
    • Component/s: None
    • None

      Please see attached patch. I encountered empty files in a DB which hat git_out.lenght = None and therefore:

      Traceback (most recent call last):
      File "backup-images.py", line 147, in <module>
      sys.exit(main(sys.argv))
      File "backup-images.py", line 144, in main
      backup_all(db, outdir, collection)
      File "backup-images.py", line 90, in backup_all
      backup_file(outname, dbobj)
      File "backup-images.py", line 38, in backup_file
      for data in dbobj:
      File "/usr/lib/python2.6/dist-packages/gridfs/grid_file.py", line 464, in _iter_
      return GridOutIterator(self, self.__chunks)
      File "/usr/lib/python2.6/dist-packages/gridfs/grid_file.py", line 489, in _init_
      self.__max_chunk = math.ceil(float(grid_out.length) /

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            agx Guido Günther
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: