Error in "reading" exercise - not such file or directory


#1


https://www.codecademy.com/en/courses/python-intermediate-en-OGNHh/0/4?curriculum_id=4f89dab3d788890003000096#

I think my code is correct, and I can't figure out what's wrong. The error message I get is:

IOError: [Errno 2] No such file or directory: 'output.txt.'

Here is the code:

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

print my_file.read()

my_file.close()

I got this error for the previous exercise, and writing something in output.txt then deleting it seemed to solve the problem, but it doesn't help here. I tried refreshing and using a different browser but nothing helps.


#2

I got the same error, having written exactly the same.


#3

Hey, I also had this problem. In my case I wrote smth in text.txt, then deleted it, then I clicked 'Save and submit' button while text.txt tab was opened. I got an error message, but then I switched tabs and clicked again 'Save and submit' and it worked.


#4

Thanks, mate, that helped me with the same issue (it happened on the next step though, but that's irrelevant, I guess).


#5

Thanks man! That worked.


#6

wow miraculous how computer errors can be avoided thanks for the tip i was thinking i would never get past that one!


#7

Thanks,

Im surprised they haven't fixed this yet. I feel bad for the beginners who are going to spend hours on this thinking they've done something wrong.


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.