Repository navigation
Description
Environment data
- VS Code version: 1.27.1
- Extension version (available under the Extensions sidebar):
C/C++
Code Runner
Python
VIM - OS and version: win10 64bit
- Python version (& distribution if applicable, e.g. Anaconda): 3.6.3
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
- Relevant/affected Python packages and their versions: N/A
Actual behavior
cd 'e:\Code\Python'; ${env:PYTHONPATH}='temp;c:\Users\zhao\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'D:\Anaconda\python.exe' '-m' 'ptvsd' '--host' 'localhost' '--port' '51495' 'e:\Code\Python\test.py'
Output:
Could not connect to localhost: 51495
Traceback (most recent call last):
File "c:\Users\zhao\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\pydevd.py", line 1743, in main
debugger.connect(host, port)
File "c:\Users\zhao\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\pydevd.py", line 349, in connect
s = start_client(host, port)
File "c:\Users\zhao\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\pydevd_hooks.py", line 81, in <lambda>
_start_client = (lambda h, p: start_client(daemon, h, p))
File "c:\Users\zhao\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\pydevd_hooks.py", line 61, in start_client
sock, start_session = daemon.start_client((host, port))
File "c:\Users\zhao\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\daemon.py", line 203, in start_client
connect(client, addr)
File "c:\Users\zhao\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\socket.py", line 174, in connect
sock.connect(addr)
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
Expected behavior
Noramlly Debugg Current file
Logs
Nothing.
I can't Debug My python code.
Everytime if press F5,Termianl will execute
cd 'e:\Code\Python'; ${env:PYTHONPATH}='temp;c:\Users\MYUSERNAME\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'D:\Anaconda\python.exe '-m' 'ptvsd' '--host' 'localhost' '--port' '51495' file.py",
then fail.
I tried uinstall python extension,but fail still.
What's wrong?
this is my launch.json:
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true
},
{
"name": "Python: Current File (External Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
}
]
}
My python path is system settings:
D:/anaconda/python.exe
Activity
brettcannon commentedon Sep 10, 2018
FYI the translation of the
WinErroris "The connection attempt failed because the connected party did not respond correctly after a period of time or the connected host did not respond.".Does
D:\Anaconda\python.exe e:\Code\Python\test.pywork from the terminal?zhaoyewei commentedon Sep 11, 2018
Brett Cannon (@brettcannon) Yes,it works as expected. python file is ran properly.
Whatever i edit launch.json,the command line executed in termianl harly change.
One thing i don't konw is that why i try to debug py file locally,there is alway
'-m' 'ptvsd' '--host' 'localhost' '--port' '51495'displayed in termianl but always connecto to localhost fail.(Port is not stable)
groeneveld commentedon Sep 11, 2018
DonJayamanne commentedon Sep 12, 2018
[-]Debugger Always Error[/-]DonJayamanne commentedon Sep 12, 2018
ZhaoTongxue
Please could you try to start a simple socket server in Python and connecting to it
Here's some sample code:
socket_server.pyin a terminalsocket_client.pyin a terminalsocket_server.pysocket_client.pyzhaoyewei commentedon Sep 13, 2018
Don Jayamanne (@DonJayamanne) Thanks,and i do what you say.(PS:your socket_client.py is the same as socket_server.py,may you have paste a false copy😂)
I ran socket_server.py and then i ran a python file which is function as client to test socket,as a result,and successed.
there is my socket_client.py:
There is what socket_server.py print out:
There is what my client socket file print out:
when i debug my pytho file in vscode,i don't know whether the port is open.
zhaoyewei commentedon Sep 13, 2018
Plus,In my .vscode/launch.json,"debugOptions" are not support by intelligense and linting.Even after serveral tries,it doesn't improve.
DonJayamanne commentedon Sep 13, 2018
launch.jsonfile and re-create it.launch.jsonand add the setting"logToFile": trueExtensions: Open Extensions Folderms-python.python-2018-**debug.log, please upload that file herezhaoyewei commentedon Sep 14, 2018
Don Jayamanne (@DonJayamanne) thanks, i tired.
The file was uploaded as appendix.
debug.log
DonJayamanne commentedon Sep 14, 2018
ZhaoTongxue
Please could you install the development version of the extension from here and give that a try. (https://github.com/Microsoft/vscode-python/blob/master/CONTRIBUTING.md#development-build)
zhaoyewei commentedon Sep 15, 2018
I uninstalled vscode-python sand installed developmemt version of the extension,however,ail again.There is debug.log.
I am confused by this situation🤔
zhaoyewei commentedon Sep 15, 2018
there is even no "debugOptions" displayed in intelligense.

The same as stable version.
zhaoyewei commentedon Sep 15, 2018
But,,after i update anaconda and reinstall vscode-python stable.It works😳
what,,what happened....