- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经开始使用 Visual Studio 代码进行远程调试,但无法让它工作。远程和本地开发 PC 都运行 ptvsd 版本 4.1.3。远程机器有脚本:
import ptvsd
ptvsd.enable_attach()
#Enable the below line of code only if you want the application to wait untill the debugger has att$
#ptvsd.wait_for_attach()
import random
guesses_made = 0
name = input('Hello! What is your name?\n')
number = random.randint(1, 20)
print('Well, {0}, I am thinking of a number between 1 and 20.'.format(name))
while guesses_made < 6:
guess = int(input('Take a guess: '))
guesses_made += 1
if guess < number:
print('Your guess is too low.')
if guess > number:
print('Your guess is too high.')
if guess == number:
break
if guess == number:
print('Good job, {0}! You guessed my number in {1} guesses!'.format(name, guesses_made))
else:
print('Nope. The number I was thinking of was {0}'.format(number))
本地计算机是:
import ptvsd
ptvsd.enable_attach(address = ('192.34.98.197',3000))
#Enable the below line of code only if you want the application to wait untill the debugger has attached to it
#ptvsd.wait_for_attach()
import random
guesses_made = 0
name = input('Hello! What is your name?\n')
number = random.randint(1, 20)
print('Well, {0}, I am thinking of a number between 1 and 20.'.format(name))
while guesses_made < 6:
guess = int(input('Take a guess: '))
guesses_made += 1
if guess < number:
print('Your guess is too low.')
if guess > number:
print('Your guess is too high.')
if guess == number:
break
if guess == number:
print('Good job, {0}! You guessed my number in {1} guesses!'.format(name, guesses_made))
else:
print('Nope. The number I was thinking of was {0}'.format(number))
我已将条目添加到 launch.json 中:
{
"name": "Attach (Remote Debug)",
"type": "python",
"request": "attach",
"localRoot": "${workspaceRoot}",
"remoteRoot": "/home/pi/testdebug/",
"port": 3000,
"secret": "my_secret",
"host":"localhost"
},
这是我收到的错误:
> PS C:\IOT\Github\RaspberryPi\test_remote_debug> python
> .\test_remote_debug.py Traceback (most recent call last): File
> ".\test_remote_debug.py", line 2, in <module>
> ptvsd.enable_attach(address = ('192.34.98.197',3000)) File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\attach_server.py", line 72,
> in enable_attach
> redirect_output=redirect_output, File "C:\Program Files (x86)\Python37-32\lib\site-packages\ptvsd\_remote.py", line 85, in
> enable_attach
> suspend=False) File "C:\Program Files (x86)\Python37-32\lib\site-packages\ptvsd\_vendored\pydevd\pydevd.py",
> line 1313, in settrace
> stop_at_frame, File "C:\Program Files (x86)\Python37-32\lib\site-packages\ptvsd\_vendored\pydevd\pydevd.py",
> line 1362, in _locked_settrace
> debugger.connect(host, port) # Note: connect can raise error. File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\_vendored\pydevd\pydevd.py",
> line 355, in connect
> s = start_client(host, port) File "C:\Program Files (x86)\Python37-32\lib\site-packages\ptvsd\pydevd_hooks.py", line 85,
> in <lambda>
> _start_client = (lambda h, p: start_client(daemon, h, p)) File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\_remote.py", line 72, in
> <lambda>
> start_client=(lambda daemon, h, port: start_daemon()), File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\_remote.py", line 64, in
> start_daemon
> _, next_session = daemon.start_server(addr=(host, port)) File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\daemon.py", line 157, in
> start_server
> self._server = create_server(addr.host, addr.port) File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\socket.py", line 77, in
> create_server
> server.bind((host, port)) OSError: [WinError 10049] The requested address is not valid in its context PS
> C:\IOT\Github\RaspberryPi\test_remote_debug> python
> .\test_remote_debug.py Traceback (most recent call last): File
> ".\test_remote_debug.py", line 2, in <module>
> ptvsd.enable_attach(address = ('192.34.98.197',3000)) File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\attach_server.py", line 72,
> in enable_attach
> redirect_output=redirect_output, File "C:\Program Files (x86)\Python37-32\lib\site-packages\ptvsd\_remote.py", line 85, in
> enable_attach
> suspend=False) File "C:\Program Files (x86)\Python37-32\lib\site-packages\ptvsd\_vendored\pydevd\pydevd.py",
> line 1313, in settrace
> stop_at_frame, File "C:\Program Files (x86)\Python37-32\lib\site-packages\ptvsd\_vendored\pydevd\pydevd.py",
> line 1362, in _locked_settrace
> debugger.connect(host, port) # Note: connect can raise error. File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\_vendored\pydevd\pydevd.py",
> line 355, in connect
> s = start_client(host, port) File "C:\Program Files (x86)\Python37-32\lib\site-packages\ptvsd\pydevd_hooks.py", line 85,
> in <lambda>
> _start_client = (lambda h, p: start_client(daemon, h, p)) File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\_remote.py", line 72, in
> <lambda>
> start_client=(lambda daemon, h, port: start_daemon()), File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\_remote.py", line 64, in
> start_daemon
> _, next_session = daemon.start_server(addr=(host, port)) File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\daemon.py", line 157, in
> start_server
> self._server = create_server(addr.host, addr.port) File "C:\Program Files
> (x86)\Python37-32\lib\site-packages\ptvsd\socket.py", line 77, in
> create_server
> server.bind((host, port)) OSError: [WinError 10049] The requested address is not valid in its context
如果有人有任何想法如何纠正此问题,请告诉我。
最佳答案
您的 launch.json
已过时,因为它是为旧调试器配置的。请参阅https://code.visualstudio.com/docs/python/debugging#_remote-debugging了解最新说明(例如 localRoot
和 remoteRoote
应位于 pathMappings
下)。
关于python - 使用 "ptvsd"运行远程调试时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52743265/
我已经开始使用 Visual Studio 代码进行远程调试,但无法让它工作。远程和本地开发 PC 都运行 ptvsd 版本 4.1.3。远程机器有脚本: import ptvsd ptvsd.ena
我已关注official doc安装ptvsd 3.2.0,并将以下代码放在目标代码的最开头。 import ptvsd ptvsd.enable_attach('my_secret') 如果运行此代
我正在尝试使用 ptvsd 从 Visual Studio 2013 调试 Linux 系统中的远程 python 应用程序。我遵循了 here 中的教程 问题是,即使两个版本,Linux 版本和 V
设置 我使用 Visual Studio 2017 (V15.8.9) 和 python 工具。当我尝试使用 ptvsd 进行远程调试时,我会看到不同的版本,具体取决于我导入 ptvsd 的位置。 在
我正在使用 Python 和 AWS-SAM-CLI 开发无服务器应用程序。我正在使用 ptvsd 库调试我的函数。为了附加调试器,以下代码段必须在函数代码中。 ptvsd.enable_attach
我正在尝试调试 docker 容器内的 python 代码。 Visual Studio Code 可以做到这一点,但我必须在远程计算机上安装 ptvsd 并编辑代码以将其导入并开始收听。 在 PyC
Python 进程我们仅限于绑定(bind)到一个 IP 地址。尝试运行 python manage.py runserver添加 ptvsd 后行导致错误。有没有解决的办法? Traceback (
我是一名优秀的程序员,十分优秀!