We're excited to announce that we're launching the second installment of Dataiku Product Days Register Now

File-like Object returned from get_download_stream is not Seekable

tech_user
Level 1
File-like Object returned from get_download_stream is not Seekable

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!

0 Kudos
1 Reply
fchataigner2
Dataiker
Dataiker

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.

A banner prompting to get Dataiku DSS