Home > Back-end >  python don't save files in visual studio code
python don't save files in visual studio code

Time:11-28

I started to use visual studio code yesterday and i'm having this problem...

Let's suppose I have this code:

myFile = open("file.txt", "w ")
myFile.write("something \n")
myFile.close()

When I run it on VScode it don't save the file, but when I run it in SublimeText it does.

do you know how to solve it?. I didn't find anything (or I don't know how to search), my launch.json look like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "internalConsole"
        }
    ]
}

**After I wrote that I noticed that it saves the file in "C: \ Users \ User \ Documents \ vsprofiles", but I have my .py file on the desktop, I want it to save the file in the same path where the .py file is, like SublimeText does.

CodePudding user response:

For completeness here is my config file

"launch": {
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "cwd": "${fileDirname}",
            "env": {},
            "pythonArgs": [],
            "stopOnEntry": false
        }
    ]
}
  • Related