Skip to content

Commit 34a4ffa

Browse files
authored
Fix scratchattach.Project.download
1 parent cb4dccf commit 34a4ffa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scratchattach/site/project.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,9 @@ def download(self, *, filename=None, dir="."):
344344
f"https://projects.scratch.mit.edu/{self.id}?token={self.project_token}",
345345
timeout=10,
346346
)
347-
filename = filename.replace(".sb3", "")
348-
open(f"{dir}{filename}.sb3", "wb").write(response.content)
347+
filename = filename.removesuffix(".sb3")
348+
with open(f"{dir}{filename}.sb3", "wb") as f:
349+
f.write(response.content)
349350
except Exception:
350351
raise (
351352
exceptions.FetchError(

0 commit comments

Comments
 (0)