Open("text.txt") doesn't work


Following error message:

Traceback (most recent call last):
File "python", line 1, in
IOError: [Errno 2] No such file or directory: 'text.txt'

And the following reply:

Oops, try again. Sorry, but I'm gonna need you to refresh the page! Don't worry your code is saved.

But no matter how often I restart I cannot pass the error message...

My solution:

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



Thanks - works! Only changing txt and than back to the program and submit


Thanks! Typing any character or a space on the .txt and then Save & Submit did the trick.


Wait, what? "Typing any character or a space on the .txt " Not sure I understand what this means. Are you editing the text.txt file some how? or putting a space in the code? I'm getting the same error and the "helpers" are telling me it is a connectivity issue. Looks like not so much.


I followed cadecodes' link above and tried the workaround that's mentioned in the linked post: making a small change in the text.txt file solved the problem for me but I don't know why it works. Good luck.



@danielwaterkant @tjsully

This topic is over a year old, so I've closed it to prevent further replies and therefore notifications flooding original participants in the thread. If you'd like to continue your discussion, please do so in a new thread or a PM, thanks.