4. Reading.. what's wrong?


#1

Hey guys :slight_smile: I'm pretty sure this is the right code but I keep getting the following message:
Traceback (most recent call last):
File "python", line 1, in
IOError: [Errno 2] No such file or directory: 'output.txtr'

Oops, try again. Did you create a variable called my_file?


#2

In your open function, you're using a + instead of a ,.
When you do this, Python thinks your adding to your file name.
The 'open' object requires the two parameters, so you need to separate them with a comma like with any other object or method.


#3

I didn't catch that sorry. So dumb.

It still gives me the error after I changed the + to ,
I think it's some kind of bug because in later chapters I didn't make the + mistake and it would give me the message every time I tried using output.txt or text.txt


#4

Something I found as well, it's just a bug.
Try writing/changing something in the output file (output.txt or file.txt) then run your code again.


#5

yeah I figured.. I tried doing that but it doesn't really help. I'll keep trying, it might eventually read it. Thanks :slight_smile:


#6

open text.txt and make some changes in the file and then launch test again - it helps me to solve such problem


#7

This definitely works!


#8

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