Browser


#1

my_file = open("output.txt", "r")
print my_file.readline()
print my_file.readline()
print my_file.readline()
my_file.close()

this code keeps giving me this error message:
Oops, try again. Sorry, but I'm gonna need you to refresh the page! Don't worry your code is saved. How can i solve this (by the way i am using chrome).


#2

++++ reset of session *****************

under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).


#3

Didn't work for me. Still stuck with the error. I've refreshed, closed down and tried a different browser. Still nothing.


#4

This worked for me and i hope it works for you.

f = open("text.txt", "w")

f.write("I'm the first line of the file!" + "\n")
f.write("I'm the second line." + "\n")
f.write("Third line here, boss." + "\n")

f.close()

my_file = open("text.txt","r")

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

my_file.close()

#5

Or as has been suggested in many other threads: simply make a small change to text.txt (add a word, or whatever) and then go back to the code. Should work now.