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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1
    • Component/s: None
    • Labels:
      None
    • # Replies:
      7
    • Last comment by Customer:
      false

      Description

      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) /

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                7 years, 10 weeks, 4 days ago
                Date of 1st Reply: