Details
Description
The unofficial Lua driver can insert chunks into GridFS with float-type chunkSize. For example, the chunkSize might be "261120.0" instead of "261120" (BSON type 0x01 instead of type 0x10 or 0x12.) Perhaps PyMongo should handle this buggy input better.
Exception info:
File "/usr/lib64/python2.6/site-packages/pymongo-2.7-py2.6-linux-x86_64.egg/gridfs/grid_file.py", line 482, in read
|
chunk_data = self.readchunk()
|
File "/usr/lib64/python2.6/site-packages/pymongo-2.7-py2.6-linux-x86_64.egg/gridfs/grid_file.py", line 454, in readchunk
|
chunk_data = chunk["data"][self.__position % self.chunk_size:]
|
TypeError: slice indices must be integers or None or have an __index__ method
|
Is chunk_size only int? Or int and float all are ok?
I found a way that modifies 'grid_file.py:454' from 'chunk_data = chunk["data"][self.__position % self.chunk_size:]' to 'chunk_data = chunk["data"][self.__position % int(self.chunk_size):]' to fix the bug.
Attachments
Issue Links
- links to