question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax not working until I change interpreter path

See original GitHub issue

Environment data

  • VS Code version: 1.54.0-1614738615.el7.x86_64
  • Extension version (available under the Extensions sidebar): python:v2021.2.582707922, jupyter:v2021.3.619093157
  • OS and version: fedora 33
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.9.2, /bin/python
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): none
  • Relevant/affected Python packages and their versions:none
  • Relevant/affected Python-related VS Code extensions and their versions: none
  • Value of the python.languageServer setting: “Pylance” version:v2021.3.0

Actual behaviour

Python syntax not working not working until I change python interpreter path.

Steps to reproduce:

  1. starts vscode: python syntax not working. Outline box is empty.
  2. change python interpreter path (/usr/bin/python to /bin/python or otherway around) syntax works, outline box lists my variable.

Settings.json files like this:

{ “python.linting.enabled”: true, “python.linting.lintOnSave”: true, “python.linting.pylintEnabled”: true, “python.languageServer”: “Pylance” }

I tried Jedii, JediLSP and microsoft. All behaviour is same.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yusyelcommented, Mar 13, 2021

@karthiknadig It’s working now. Issue was I forgot “},” for pylint area I assume. Thanks!

0reactions
karthiknadigcommented, Mar 12, 2021

@yusyel replace your entire settings file with the content below. It does not follow the expected JSON syntax.

{
    "workbench.startupEditor": "newUntitledFile",
    "files.associations": {
        "*.sh": "shellscript"
    },
    "r.rterm.linux": "/usr/bin/R",
    "explorer.confirmDelete": false,
    "editor.fontFamily": "Fira Code",
    "terminal.integrated.fontFamily": "Fira Code",
    "editor.fontLigatures": true,
    "editor.wordWrap": "wordWrapColumn",
    "editor.wordWrapColumn": 160,
    "workbench.panel.defaultLocation": "right",
    "terminal.integrated.shell.linux": "/usr/bin/bash",
    "terminal.integrated.shellArgs.linux": [
        "-l"
    ],
    "workbench.colorTheme": "Xcode Partial (Dark)",
    "workbench.colorCustomizations": {
        "terminal.background": "#212735",
        "terminal.foreground": "#E5E9F0",
        "terminalCursor.background": "#E5E9F0",
        "terminalCursor.foreground": "#E5E9F0",
        "terminal.ansiBlack": "#2E3440",
        "terminal.ansiBlue": "#773d3d",
        "terminal.ansiBrightBlack": "#4C566A",
        "terminal.ansiBrightBlue": "#EBCB8B",
        "terminal.ansiBrightCyan": "#D08770",
        "terminal.ansiBrightGreen": "#BF616A",
        "terminal.ansiBrightMagenta": "#A3BE8C",
        "terminal.ansiBrightRed": "#88C0D0",
        "terminal.ansiBrightWhite": "#ffffff",
        "terminal.ansiBrightYellow": "#5E81AC",
        "terminal.ansiCyan": "#D08770",
        "terminal.ansiGreen": "#BF616A",
        "terminal.ansiMagenta": "#A3BE8C",
        "terminal.ansiRed": "#88C0D0",
        "terminal.ansiWhite": "#E5E9F0",
        "terminal.ansiYellow": "#5E81AC"
    },
    "python.linting.enabled": true,
    "python.linting.lintOnSave": true,
    "python.linting.pylintEnabled": true,
    "python.languageServer": "Pylance",
    "editor.semanticTokenColorCustomizations": {
        "[One Dark Pro]": { 
            "enabled": true,
            "rules": {
                "magicFunction:python": "#ee0000",
                "function.declaration:python": "#990000",
                ".decorator:python": "#0000dd",
                ".typeHint:python": "#5500aa",
                "*.typeHintComment:python": "#aaaaaa"
            }
        }
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot detect and python interpreters · Issue #5455 - GitHub
Install VS Code; Install python extension; Try to set the interpreter(none is found and 'hardcoding' it does not seem to have any effect)....
Read more >
Using Python environments in VS Code
To select a specific environment, use the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P).
Read more >
Invalid Syntax in Python: Common Reasons for SyntaxError
When the interpreter encounters invalid syntax in Python code, it will raise a SyntaxError exception and provide a traceback with some helpful information...
Read more >
Configure a Python interpreter | PyCharm Documentation
You can modify the path to the Python executable in the Interpreter path field. To change the interpreter name, select the target interpreter...
Read more >
Manage Python environments and interpreters - Visual Studio ...
Install Python interpreters and packages and assign environments to ... it doesn't provide a way to change it from within Visual Studio.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found