[Python] VS Code not reading files in directory. Setting unable to change

Discussão em 'Python' iniciado por Stack, Maio 5, 2025.

  1. Stack

    Stack Membro Participativo

    When attempting to read a file, VS code is returning an error message.

    " FileNotFoundError: [Errno 2] No such file or directory: 'numbers.txt' "

    I am following Helsinki's Python MOOC and it recommends to enable the setting 'Python > Terminal: Execute In File Directory'.

    When attempting to turn this setting on, VS Code presents an error message.

    "Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again."

    I believe I need to update the setting in the JSON file but I'm not sure how to do that correctly.

    What I have is as follows:

    {
    "workbench.colorTheme": "Default High Contrast",
    "code-runner.runInTerminal": true
    "code-runner.executorMap": {
    "python": "python3 -u"
    "python.terminal.executeInFileDir": true
    }
    }


    The

    "python.terminal.executeInFileDir": true


    line is what I have added to the file but this is probably incorrect as the setting still shows that it's not enabled and I'm still getting the error message.

    Continue reading...

Compartilhe esta Página