On Wed, Apr 14, 2021 at 9:14 AM Quentin Bock <qberz2...@gmail.com> wrote:

> I receive this error when I try to open a file
> The file (what I'm trying to open) is in the same folder as the program I'm
> trying to open it from; why is it saying no such file or directory?
>
> this is the only part of the code that causes the error
>
> file = open('Egils Saga 1-15.txt', "r")
>
> file.close()
>

Python will try to open the file in the directory you are currently in,
rather than the directory your program is in.

Try cd'ing to the appropriate directory first.  Or specify a full to your
file in the open.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to