skip to Main Content

When i run the script this error is raised. But, the files are in this directory, i tried multiple ways to find these files.

I tried the

os.path.join("mydir", "myfile")

method. But the file was not found.

So i searched a little and tried this, but with no results:

with open (os.path.join("database", "weather_data.csv")) as file:
    csv_database = pd.read_csv(file)

The file structure:
enter image description here
How i fix that?

2

Answers


  1. Chosen as BEST ANSWER

    That was a weird bug on my vscode. I just refresh the explorer on my vscode and the code works fine.


    1. Verify your File Path once again.

    2. Then Check your .Current Working Directory.

      import os
      print("Current Working Directory:", os.getcwd())

    3. Refresh the VSCode Explorer

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search