Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi!
I am trying to read DICOM images through a Python recipe. However, I receive this error "UnsupportedOperation: seek" (see the attached image for reference). I have tried the same code to read the image locally and it works fine. Do you have any idea why I receive this error?
P.S. I uploaded the image in a managed folder in DSS
Thanks,
Konstantina
Hi @konathan,
If you see -> "UnsupportedOperation: seek" you need to copy the file locally or in tempfile/tempdir.
get_download_stream() is indeed not seekable.
import dataiku
import tempfile
# Replace "replace_folder_id" with your actual folder ID
image_fldr = dataiku.Folder("replace_folder_id")
# Replace "file-name.jpg" and suffix
with image_fldr.get_download_stream("file-name.jpg") as f:
with tempfile.NamedTemporaryFile(suffix=".jpg") as temp_image:
temp_image.write(f.read())
temp_image.seek(0)
#continue the rest of your code on the specific files
Hi @konathan,
If you see -> "UnsupportedOperation: seek" you need to copy the file locally or in tempfile/tempdir.
get_download_stream() is indeed not seekable.
import dataiku
import tempfile
# Replace "replace_folder_id" with your actual folder ID
image_fldr = dataiku.Folder("replace_folder_id")
# Replace "file-name.jpg" and suffix
with image_fldr.get_download_stream("file-name.jpg") as f:
with tempfile.NamedTemporaryFile(suffix=".jpg") as temp_image:
temp_image.write(f.read())
temp_image.seek(0)
#continue the rest of your code on the specific files
Thank you @AlexT for the help!