Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 67,779 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 ()