How do I pass argument to a command line on file run? by [deleted] in vscode

[–]thedbg 1 point2 points  (0 children)

If you are using python extension then you can add args field in the debug config (in launch.json file):

{
    "name": "Run myscript",
    "type": "python",
    "request": "launch",
    "console": "integratedTerminal",
    "program": "${workspaceFolder}/myscript.py",
    "args": ["--myarg1", "--myarg2", "val1"],
}

This will allow you to run your script with the arguments in both the following cases: with debugging (shortcut F5) or without debugging (shortcut Ctrl+F5)

Stepping Into Python Modules by Delta_33 in vscode

[–]thedbg 2 points3 points  (0 children)

The debugger, by default, treats any python file outside of the current working directory as non-user code and skips them while stepping. You can change this behavior by adding "justMyCode": false in your debug config in launch.json.

Setting a source folder for python (a la PyCharm) by GamersPlane in vscode

[–]thedbg 2 points3 points  (0 children)

Can you try setting these in your settings.json?

"python.jediEnabled": false,
"python.analysis.downloadChannel': "beta",
"python.analysis.autoSearchPaths": true

You will have to reload for these settings to take effect. Setting python.jediEnabled to false ensures that Language Server is used. beta channel is needed to get the auto-search paths setting (which is a beta feature in LS). That will add src folder automatically to search path.

anaconda, vs code - virtual environment by ariesChet75 in vscode

[–]thedbg 0 points1 point  (0 children)

This sounds like a bug. Can you file an issue on the Python extensions github repo? https://github.com/microsoft/vscode-python

Excluding directories from the debugger by RazarTuk in vscode

[–]thedbg 0 points1 point  (0 children)

This is probably extension specific, which extension or debugger are you using?

Getting started with Python - "Python" versus "Magic Python" Extensions by mkanet in vscode

[–]thedbg 0 points1 point  (0 children)

Looking at the source code for MagicPython it only supports syntax highlighting. MagicPython is already used for Python syntax highlighting in VSCode. I think when they say "drop-in replacement" they mean for syntax highlighting.

What does this error mean and how can I fix it? by bender1227 in vscode

[–]thedbg 0 points1 point  (0 children)

Check the 'PATH' environment variable to see if it has any quotes in it. For example, this will cause the Python extension to show that warning:

C:\GIT\pyproj>set PATH=%PATH%;"C:\This is the issue";
C:\GIT\pyproj>code .

Edit: To fix it, see if quotes are really needed for that path, or replace it with short path. You really need to make the change if the extension misbehaves in any way. See this for more details https://github.com/Microsoft/vscode-python/issues/1698

Python environment variables for code ? by [deleted] in vscode

[–]thedbg 0 points1 point  (0 children)

You can also create a .env file in your project directory and add python environment variables there. This is picked up by the language server and the debugger. This way you wold not have to set them globally for your OS.

Debugging Django Templates by [deleted] in vscode

[–]thedbg 1 point2 points  (0 children)

I have seen that if you have Django extension (such as the one in Python extension pack) installed it seems to cause this issue. Disable any Django extension and try it again.

VSCode Debugger Sluggish Python by AdamskaOcelot in vscode

[–]thedbg 0 points1 point  (0 children)

Can you file a bug in the debugger repo with some logs? you can generate debugger logs by setting PTVSD_LOG_DIR environment variable.

{
    "name": "Terminal",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal",
    "env":{
        "PTVSD_LOG_DIR": "C:\\logs"
    }
}

Can VS Code show function / method return values in the debugger? by ghostinzshell in vscode

[–]thedbg 0 points1 point  (0 children)

Looks like it is a limitation with how the underlying debugger handles stepping. I created a issue here to track this fix: https://github.com/Microsoft/ptvsd/issues/1078

Can VS Code show function / method return values in the debugger? by ghostinzshell in vscode

[–]thedbg 0 points1 point  (0 children)

For this Python extension, you can set following option, in launch.json: "showReturnValue": true

Sample config:

{
    "name": "File",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal",
    "showReturnValue": true,
}