Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialWarren Gates
17,401 PointsNow close the file_object file so it isn't taking up memory.
This is my code, follows the example from the video, not sure why it isn't passing. Python
file_object = open("basics.txt", encoding="utf-8") data = file_object.read() file_object.close()
file_object = open("basics.txt", encoding="utf-8")
data = file_object.read()
file_object.close()
Chris Freeman
Treehouse Moderator 68,457 PointsThis has been raised with Treehouse staff. Stay tuned....
4 Answers
Craig Dennis
Treehouse TeacherThis is fixed now! Thank you for reporting it Warren Gates !
Mathieu HAYS
9,623 PointsI think your code is correct, I tried it locally and it works as expected.
I even tried to read from the file after it has been closed and I got an error specifically because the file was indeed closed.
I think Treehouse's validation fails to detect that the file object is closed.
Warren Gates
17,401 Pointswhat do I do? I need this to be completed.
Mathieu HAYS
9,623 PointsI've reported the bug to them. Apparently they're mainly replying during business hours (Pacific Time).
I don't know how quickly we can expect this to be fixed.
In the mean time I would recommend you to skip the challenge. Skipping the challenge doesn't seem to prevent you to complete the other ones.
Hsufeng Lee
16,440 PointsI have the same question. It seems to be a bug.
Chipo Makawa
5,919 Pointsfile_object = open("basics.txt", encoding = "utf-8") data = file_object.read() file_object.close ()
Mathieu HAYS
9,623 PointsMathieu HAYS
9,623 PointsFor the attention of the support team:
The task in question is Task #3
Error message:
Bummer! Did you close the file?