我有一个虚拟机运行一个python进程,我想从我的主机调试它。我的虚拟机ip是192.168.10.20。按照指示,我将我的launch.json设置为
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"localRoot": "/Users/wrkspace",
"remoteRoot": "/home/wrkspace",
"port": 3000,
"secret": "my_secret",
"host": "192.168.10.20"
},
我有两个文件,一个在我的主机上,一个在我的vm上,名为test.py,它是一个helloworld,请求用户输入我的主机在文件的顶部有这个文件
ptvsd.enable_attach("my_secret", address = ('192.168.10.20'3000))
# Enable the line of source code below only if you want the application
to wait until the debugger has attached to it
#ptvsd.wait_for_attach()
在我的vm上,我想在其中调试
ptvsd.enable_attach("my_secret", address = ('192.168.10.20'3000))
# Enable the line of source code below only if you want the application
to wait until the debugger has attached to it
ptvsd.wait_for_attach()
一旦我运行了附带的调试器,然后通过python启动vm上的测试。它看起来好像做了什么,但却失败了
启动调试服务器时出错。Error=“代码”:“ENETUNREACH”,"errno":"ENETUNREACH","syscall":"connect","address":"192.168.10.20","port":3000}
启动调试服务器时出错。Error = {"code":"ENETUNREACH","errno":"ENETUNREACH","syscall":"connect","address":"192.168.10.20","port":3000}
我遗漏了什么吗?
发布于 2018-03-08 09:23:25
几个步骤来解决这些问题:
1)使用"nc -zv test.com 30302“测试调试端口,以确保它是打开的。 2)确保您的was服务器在调试器连接到应用程序后不会重新加载应用程序。这是烧瓶的选择:“use_reloader=False”
https://stackoverflow.com/questions/48347121
复制相似问题