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 trial

Python Regular Expressions in Python Introduction to Regular Expressions The Basics

Now 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()

basics.py
file_object = open("basics.txt", encoding="utf-8")
data = file_object.read()
file_object.close()
Mathieu HAYS
Mathieu HAYS
9,623 Points

For the attention of the support team:

The task in question is Task #3

Error message: Bummer! Did you close the file?

Chris Freeman
Chris Freeman
Treehouse Moderator 68,457 Points

This has been raised with Treehouse staff. Stay tuned....

4 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

This is fixed now! Thank you for reporting it Warren Gates !

Mathieu HAYS
Mathieu HAYS
9,623 Points

I 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.

what do I do? I need this to be completed.

Mathieu HAYS
Mathieu HAYS
9,623 Points

I'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.

I have the same question. It seems to be a bug.

file_object = open("basics.txt", encoding = "utf-8") data = file_object.read() file_object.close ()