如何解决VsCode在运行模式和调试模式之间的不同行为
当我在运行模式下运行以下python代码时,响应等于0,当我在调试模式下运行时,响应为127,并且发生了故障/bin/sh: ping: command not found
。
cmd = '-c 1'
host = 192.168.1.1
response = subprocess.call(f'ping {cmd} {host},shell=True')
我的launch.json看起来像这样:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information,visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0","configurations": [
{
"name": "Python: Current File","type": "python","request": "launch","program": "${file}","console": "integratedTerminal"
}
]
}
使用response = os.system(f'ping {cmd} {host}')
时,运行模式下的响应为0,而在调试模式下,响应为32512,并且发生了故障sh: ping: command not found
。
有人可以帮我吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。