[Python] Why am I getting this FileNotFoundError [duplicate]

Discussão em 'Python' iniciado por Stack, Julho 3, 2025.

  1. Stack

    Stack Membro Participativo

    I've been working on this Python project on and off for about two years and the code has worked just fine since I first put it in, and was working just fine the last time I looked at it about 2 months ago. Nothing has changed, the specified file is and always has been in the same directory as the script and it is now, suddenly, giving me a FileNotFoundError

    filename = 'natures.csv'

    NATURES = {}

    try:
    with open(filename) as file_object:
    lines = file_object.readlines()
    except FileNotFoundError:
    print("uh oh")
    pass


    PS C:\Users\light> & C:/Python/python.exe "c:/Users/light/Desktop/My Little PokeProject owo/NatureFileReader.py"
    uh oh
    PS C:\Users\light>

    Continue reading...

Compartilhe esta Página