Sid72020123 / scratchconnect

Python Library to connect Scratch API and much more.
https://sid72020123.github.io/scratchconnect/
MIT License
25 stars 14 forks source link

Use a context manager file while setting thumbnail #32

Closed Chiroyce1 closed 2 years ago

Chiroyce1 commented 2 years ago

This closes the file after reading data. Once a file has been opened, you should always close it after reading or writing data to it. A better solution is to use a context manager:

with open(filename) as file:
    data = file.read()
# The file will automatically be closed after the above line
Sid72020123 commented 2 years ago

Thanks!

Sid72020123 commented 2 years ago

I will merge this later after my exams...

Chiroyce1 commented 2 years ago

I will merge this later after my exams...

Sure, take your time!