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
Leila Hardy
5,601 PointsI don't understand the error I'm getting in task 5/5 in The Basics code challenge.
import re
file_object = open("basics.txt", encoding="utf-8")
data = file_object.read()
file_object.close()
first = re.match(r'Four', data)
liberty = re.search(r'Liberty', data)
The question is :
"Finally, make a new variable named liberty that is an re.search() for the word "Liberty" in our data variable."
I am getting the 'Oops! It looks like Task 1 is no longer passing.' What is triggering this message, and how can I fix it? Thanks a bunch!
3 Answers
Matthew Carr
11,220 PointsI copied and pasted your code into the question and it ran through all 5 tests and said they were all correct. Maybe there was a temporary glitch?
Ryan Ruscett
23,309 PointsThis is a good question. So if you run this in an editor it will fail encoding is not a proper argument.
If you want encoding in Python you can do an import like this. from io import open
There is an io.open or an open.io which outlines the difference between say Python 2.x and Python 3.x
If I use Python 2.7 to compile your code I will get the same error. If I use python 3.4 I do not. If I import like the example below, I can use your code in python 2.7 and it still works.
Just one of the very few struggles in writing with python is that versions are a cause for porting your code to work for other versions etc.
Hope this helps, let me know if you still have any questions.
Matthew Carr
11,220 PointsTreehouse is using Python 3.4 though, so the original poster should not be getting the error. How are you getting the 'Oops! It looks like Task 1 is no longer passing.' error? That isn't a python interpreter error, it's only an error passed by the interface for the quizzes.
Leila Hardy
5,601 PointsYes, I think it was a temporary glitch. I reloaded the page several times and all of the code passed.
Ary de Oliveira
Courses Plus Student 28,304 PointsAry de Oliveira
Courses Plus Student 28,304 Pointsliberty no Liberty l # L