简体   繁体   中英

Cannot see current debugged line in Visual Studio Code / Python / ptvsd

While remote debugging a simple Python program on a Raspberry, from a PC, it seems to work correctly (hitting F10 or F5 does what it should) except that I cannot see the current line debugged (the current line is not highlighted).

Also, the breakpoints have gray circle instead of red one, so I thing I miss something.

Code being debugged (commented out lines are un-commented on remote machine, of course):

# import ptvsd
# ptvsd.enable_attach('my_secret', address=('192.168.1.27', 3000))
# ptvsd.wait_for_attach()
# ptvsd.break_into_debugger()

print("Hello, World!")

for i in range(10):
    print("i = {0}".format(i))

and launch.json python attach config:

    {
        "name": "Python: Attach",
        "type": "python",
        "request": "attach",
        "localRoot": "${workspaceFolder}",
        "remoteRoot": "${workspaceFolder}",
        "port": 3000,
        "secret": "my_secret",
        "host": "192.168.1.27"
    },

Any idea?

EDIT: ptvsd version is 3.0.0 on both machines

Thanks a lot

Patrice

For Visual Studio Code, you'll need to install ptvsd==2.2.0 rather than 3.0.

The 3.0 series of ptvsd is for Visual Studio 2017 only. However, the 4.0 series will be the same for both Visual Studio and Visual Studio Code. You can install this using pip install --pre ptvsd (as it's in preview) and follow the instructions here to enable it.

Once 4.0 becomes the default (sometime in mid-2018), you will just be able to install the latest ptvsd to use with any up-to-date Visual Studio or Visual Studio Code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM