gridfs - read video file from mongodb with pymongo -
i have large video file stored in mongodb gridfs. read , write on disk. can find file in database with:
file = grid_fs.find_one({"filename":'file_in_database.cin'})
i grid out object gridfs.grid_file.gridout @ 0xa7b7be0
i try write file on disk with:
open('file_from_database.cin', 'w') f: f.write(file.read())
i file written size of 1 download database different original size of file:
05/15/2015 09:09 65,585,808 file_from_database.cin 08/01/2007 01:08 pm 65,585,800 original_file.cin
i checked file in database , md5 field same original problem must during download or writing.
i'm using win7 64 , anaconda64 dirstribution python 2.7
any appreciated.
update
i tried same code jpeg image , same problem, image stored in database when , write disk size different , cannot read it.
03/20/2015 02:36 pm 5,422,339 original_image.jpg 05/15/2015 02:44 pm 5,438,750 image_from_database.jpg
am doing simple mistake reading gridout , writing disk?
interesttingly if open image with:
pil.image.open(file)
i can image fine. idea?
Comments
Post a Comment