5. Reading Between the Lines - I think this might be a bug

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

It tels me to refresh the page because it didn’t find the file text.txt. I refresh it but the same problem occurs again.


<Below this line, add a link to the EXACT exercise that you are stuck at.>

Here’s the lesson:
https://www.codecademy.com/en/courses/python-intermediate-en-OGNHh/1/1?curriculum_id=4f89dab3d788890003000096#

<In what way does your code behave incorrectly? Include ALL error messages.>

<What do you expect to happen instead?>

```python

my_file = open(“text.txt” ,“r”)

print my_file.readline()
print my_file.readline()
print my_file.readline()

my_file.close()

<do not remove the three backticks above>
4 Likes

HI, I’m having the same problem, too.
Entered the same code and getting the same error message.

Hopefully this can be fixed !
Kind Regards,
Bjorn

1 Like

Same problem here!!!

This worked for me:

https://discuss.codecademy.com/t/5-9-error-solved/3332

12 Likes

Nicely done! This works great and gives more practice writing to files anyway :wink:

Having same problem here. Thought I was seeing things :wink:

Thanks for help!

It was solved. Just add a 4th line in the text.txt file

10 Likes

This works, but you need to make sure you refresh the page first, then add the 4th line then run the code.

Hope they fix this though…

1 Like

This worked for me:

my_file = open(“text.txt” ,“r”)

print my_file.readline() * 3

my_file.close()

2 Likes

I know this is solved however if you just remove the ! mark of the first line in text.txt it also solves the problem without having to add a line :slight_smile:

4 Likes

Hi,
thanks That solved the problem.
but did not get how will removing ! solve the problem

I’m having the same problem. Cannot finish the Python course because of this.

editing the file causes it ro be saved which creates the file,

make any small modification then change it back again

4 Likes

Worked for me. Thanks boss!

I do not understand how this was input into the terminal. Is this the only code? A new line? also it ends with an elipses, was there more that got cut off? This section of the course seems very broken

Just simply remove the “!” at the end of the first line of the text.txt file. It will work.

3 Likes

Same here, by just removing the ! the problem was gone

yes worked for me too, reporting this as a bug inside the lesson…

love it! worked for me too. great solution.

Removing the “!” from the first sentence in the text.txt work for me as well. What an exercise in frustration that was!