NKI-AI / slidescore-api

Python utilities to interface with SlideScore
Apache License 2.0
3 stars 3 forks source link

io.UnsupportedOperation: not writable #4

Closed AjeyPaiK closed 2 years ago

AjeyPaiK commented 2 years ago

Describe the bug json.dump fails while writing annotations to file.

To Reproduce (I have access to study 638) slidescore -s 638 download-labels ~/junk/

Expected behavior The cli must write annotations for each file in study 638 as json in the directory named ~/junk/

Environment SlideScore Python API version: 0.1.0 How installed: Installed the CLI from repo. Python version: 3.8.12 Operating System: Ubuntu 20.04.3 LTS

Capture .

jonasteuwen commented 2 years ago

What is precisely the reason it fails? Seems just like your folder is not writeable.

AjeyPaiK commented 2 years ago

Well, I got the bug when the file was opened without a mode in download_labels(). It was a simple bug.

    Before - `with open(save_dir / f"{image_id}.json") as file:`
    Now - `with open(save_dir / f"{image_id}.json", "w") as file:`
jonasteuwen commented 2 years ago

Seems to be fixed @AjeyPaiK ?

AjeyPaiK commented 2 years ago

Yes, this is fixed.

AjeyPaiK commented 2 years ago

It is addressed in #5