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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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 Hackett
            Reporter:
            Guido Günther
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: