How to get clipboard data (audio) into BufferedReader?

I need to get the duration of an audio clip that’s in the Windows clipboard. The wavy library can give me that info, but it needs the data to be in a BufferedReader.
I tried this:
io.BufferedReader(dataObj.GetData())
But it threw an exception: ‘memoryview’ object has no attribute ‘readable’.
How can I get the clipboard data into a BufferedReader?

the way is to get the data from the clipboard via wx.Clipboard, check the wx.DataObject and if it is supported just feed it into the BufferedReader: your wavy library may enjoy it… :face_with_hand_over_mouth:

Thank you for the suggestion. Unfortunately, it didn’t work.
Here’s my entire test program:

import io
import wx
import wavy

a = wx.App()        # necessary wx initialization
if not wx.TheClipboard.Open() : raise Exception("Clipboard.Open failed")
dfRiff = wx.DataFormat(11)    # 11 = RIFF, 12 = WAVE
if not wx.TheClipboard.IsSupported(dfRiff) : raise Exception("no audio in clipboard")
dObj = wx.CustomDataObject(dfRiff)
if not wx.TheClipboard.GetData(dObj) : raise Exception("GetData failed")
wx.TheClipboard.Close()
dbuf = dObj.GetData()
rdr = io.BufferedReader(dbuf)      # <- exception thrown here
audio = wavy.read(rdr)
print("success!")
print(str(audio))

And here’s what happens when I run it with audio in the clipboard:

Exception has occurred: AttributeError
'memoryview' object has no attribute 'readable'
  File "W:\Python\ClipboardAudioSize\TestClipboardAudio.py", line 13, in <module>
    rdr = io.BufferedReader(dbuf)

If I pass ‘dObj’ directly to io.BufferedReader, it throws the same exception, except that it says ‘CustomDataObject’ instead of ‘memoryview’.