-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Minor - P4
-
None
-
Affects Version/s: 3.5
-
Component/s: GridFS
-
None
-
Environment:Ubuntu 16.04 LTS in virtualbox
I stored wav-files in MongoDB using GridFS. I read from the file through the wave module. This mostly works except occasionally I get a type error : TypeError: integer argument expected, got 'numpy.int64'.
I can trace this back to a position parameter set through the wave module. This is a numpy.int64, if I cast it to int before calling the setpos method from the wave module the problem disappears.
This is a good workaround, but not exactly elegant.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-18-e7b859802239> in <module>()
36 #print(wf.tell())
37 stream.write(data)
---> 38 data = wf.readframes(chunk)
39
40 # cleanup stuff.
/usr/lib/python3.5/wave.py in readframes(self, nframes)
240 if nframes == 0:
241 return b''
--> 242 data = self._data_chunk.read(nframes * self._framesize)
243 if self._sampwidth != 1 and sys.byteorder == 'big':
244 data = audioop.byteswap(data, self._sampwidth)
/usr/lib/python3.5/chunk.py in read(self, size)
134 if size > self.chunksize - self.size_read:
135 size = self.chunksize - self.size_read
--> 136 data = self.file.read(size)
137 self.size_read = self.size_read + len(data)
138 if self.size_read == self.chunksize and \
/usr/lib/python3.5/chunk.py in read(self, size)
134 if size > self.chunksize - self.size_read:
135 size = self.chunksize - self.size_read
--> 136 data = self.file.read(size)
137 self.size_read = self.size_read + len(data)
138 if self.size_read == self.chunksize and \
~/.local/lib/python3.5/site-packages/gridfs/grid_file.py in read(self, size)
510 self.__buffer = data.read()
511 data.seek(0)
--> 512 return data.read(size)
513
514 def readline(self, size=-1):
TypeError: integer argument expected, got 'numpy.int64'