• Uncategorized

About python : VSCode-Python-debugging-doesnt-have-same-PATH-as-interpreter

Question Detail

Essentially, using the debugger doesn’t seem to be loading my .zshrc while the integrated terminal does. i.e. this simple test outputs different code when I debug vs. when I just call pytest in the terminal:

class TestPath(unittest.TestCase):

    def test_path(self):
        import os
        print(os.environ['PATH'])

This is a problem for me as I use shutil.which(...) to find executables. I know it’s finding the correct Python since sys.version yields the same results in both the debugger REPL and through terminal.

I even added the following block to my settings.json which I never had before to explicitly point to the correct shell:

    "terminal.integrated.profiles.linux": {
      "zsh (login)": {
        "path": "/usr/bin/zsh",
        "args": ["-l"]
      }
    },
    "terminal.integrated.defaultProfile.linux": "zsh",
    "terminal.integrated.automationShell.linux": "/usr/bin/zsh",

This has never been problem till recently, and I’ve had lots of debugging related issues since VSCode 1.62. I’ve downgraded twice and even set "update.mode" : "none", but Bill seemingly keeps hacking in and forcing me to upgrade.

Any insight is appreciated!

Thanks

Question Answer

Could you try to update the Python Extension? some people have run across a similar problem, you can have a look at this link.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.