Error printing sys.path
See original GitHub issueEnvironment data
VS Code version: 1.19.2 Python Extension version: 0.9.1 Python Version: 2.7.14 (Anaconda) OS and version: Windows 10 , version 1709, build 16299.192
Actual behavior
Sometimes i get a No such file or directory
error pointing at the line where print sys.path
is placed. This does not happen every time the code is run and does not happen outside of Visual Studio Code (command prompt, powershell, ipython and jupyter are fine).
Expected behavior
I expected the code to always print correctly with no errors.
Steps to reproduce:
Create a new file in Visual Studio Code and add the following lines
import sys
print sys.path
Right click inside window and select Run python file in Terminal
.
Logs
Output from Python
output panel
C:\Users\aless\Documents\code\PythonProjects\Test>python c:/Users/aless/Documents/code/PythonProjects/Test/test.py
['c:\\Users\\aless\\Documents\\code\\PythonProjects\\Test', 'C:\\Users\\aless\\Miniconda2\\python27.zip', 'C:\\Users\\aless\\Miniconda2\\DLLs', 'C:\\Users\\aless\\Miniconda2\\lib', 'C:\\Users\\aless\\Miniconda2\\lib\\plat-win', 'C:\\Users\\aless\\Miniconda2\\lib\\lib-tk', 'C:\\Users\\aless\\Miniconda2', 'C:\\Users\\aless\\Miniconda2\\lib\\site-packages', 'C:\\Users\\aless\\Miniconda2\\lib\\site-packages\\win32'Traceback (most recent call last):
File "c:/Users/aless/Documents/code/PythonProjects/Test/test.py", line 2, in <module>
print sys.path
IOError: [Errno 2] No such file or directory
Output from Console window
(Help->Developer Tools menu)
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:4054 [C:\Users\aless\.vscode\extensions\ms-vscode.cpptools-0.14.6]: Il comando `workbench.action.gotoSymbol` è presente più volte nella sezione `commands`.
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:4054 [C:\Users\aless\.vscode\extensions\ms-vscode.cpptools-0.14.6]: Il comando `workbench.action.showAllSymbols` è presente più volte nella sezione `commands`.
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2571 [Extension Host] debugger listening on port 9333
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2569 [Extension Host] debugger inspector at %cDebugger listening on port 9333.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9333/6fc63825-c520-4878-abb9-a26e74f6b157
This is my fist time pointing out an issue so if I made some mistakes i’m sorry, i’m no expert, blame my lack of experience.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (1 by maintainers)
Top GitHub Comments
+1 Also experiencing a similar problem - it looks like print occasionally fails with an IOError. It’s very hard to reproduce consistently.
I believe this is the same as a Windows bug that has been reported upstream on VS Code and should get fixed at some point (I have no insight on Windows bugfix release schedules so I can’t give an ETA).