r/learnpython • • Jan 08 '23

*urgent ish*

I don’t have a scoobie what’s wrong here, been coding a couple months (not a crazy am tho as have been away) And completing free conde camp p4e course, and gunna move on to other after

And I’m tryna get this thing open but aprently it’s not in the dorectory Wich I think it is…. Please.. need help

Thanks (Excuse my shyte spelling)

(Using vs code) - on the left it says (where my file is)

EX.07-01 ex_07-01.py Workfile.txt

I’m tryna get work file to open

My code is just

F = open(‘workfile.txt’) For line in f: Print(f)

Thnx

0 Upvotes

18 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Jan 08 '23

Traceback(most recent call last)

And the error is

FileNotFoundError: [Errno 2] no such file or directory ‘workfile.txt’

1

u/bbye98 Jan 08 '23

You need to change the directory to where the file is stored using the os module.

1

u/[deleted] Jan 08 '23

Can u explain in monkey terms I don’t follow