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


#1

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()
my_file.close()


#2

#3

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


#4

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


#5

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.


#6

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.


#7

#8

@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.