File-like Object returned from get_download_stream is not Seekable
tech_user
Registered Posts: 4 ✭✭✭
Hello,
I am using the dataiku.Folder class to read files from a container. I am specifically using the file=folder.get_download_stream method to read the file. However, I need to use the seek() method to sets the file's current position at a specific offset. The file object returned however is not seekable and running the file.seekable() method return false. Can I read the file using a method that returns a seekable file object similar to the open(path,file_name) command?
Thanks!
Answers
-
Hi,
to get a seekable object, you'll need to dump the stream from get_downlaod_stream() into a temporary file. The object returned by the API is a HTTP stream, and as such, isn't seekable.