4. Reading.. what's wrong?


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?


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.


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


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.


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:


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


This definitely works!


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