Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error printing sys.path #601

Closed
Thalos12 opened this issue Jan 19, 2018 · 13 comments
Closed

Error printing sys.path #601

Thalos12 opened this issue Jan 19, 2018 · 13 comments

Comments

@Thalos12
Copy link

Environment 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.

@DonJayamanne
Copy link

Please could you install the insiders build and confirm this works as expected. Here's the link with instructions https://github.com/Microsoft/vscode-python/blob/master/CONTRIBUTING.md#insiders-build

This could be related to #436

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug area-debugging info-needed Issue requires more information from poster labels Jan 19, 2018
@Thalos12
Copy link
Author

I installed the 2018.1.0-alpha version but again sometimes i get the error and sometimes i don't.

@DonJayamanne
Copy link

DonJayamanne commented Jan 21, 2018

version but again sometimes i get the error and sometimes i don't.

Please could you try to consistently replicate the issue and send us the instructions. Thanks

@Thalos12
Copy link
Author

Everything is exactly as before, nothing has changed, i still randomly get IOError: [Errno 2] No such file or directory when running

import sys
print sys.path

@Thalos12
Copy link
Author

Apparently, this issue isn't present in python 3.6.

@DonJayamanne
Copy link

@brettcannon assigned to Jan milestone as this is related to #436

@DonJayamanne
Copy link

@Thalos12
Please could you try running the file in the terminal manually. I'm expecting the problem to still exist. Thanks.

@Thalos12
Copy link
Author

@DonJayamanne
Exactly as you suspected, running the file manually in the terminal produces the same error.

@DonJayamanne
Copy link

I'm closing this as it's not an issue with the extension.
My suggestion is to check the path variables.

@DonJayamanne DonJayamanne added closed-invalid and removed awaiting 1-verification area-debugging bug Issue identified by VS Code Team member as probable bug labels Jan 26, 2018
@DonJayamanne DonJayamanne removed this from the January 2018 milestone Jan 26, 2018
@Thalos12
Copy link
Author

Thalos12 commented Jan 26, 2018

@DonJayamanne
Maybe i misunderstood before, but this happens only inside vscode, not outside. I thought you were referring to vscode's terminal. In the command prompt or powershell or other the script runs fine. Furthermore, i tried to use another extension to run the python script and everything runs without errors

@hanssusilo
Copy link

+1
Also experiencing a similar problem - it looks like print occasionally fails with an IOError. It's very hard to reproduce consistently.

@AndresRabinowicz
Copy link

In vscode do:

  1. Python
  2. in the python terminal type for x in range(0,1000): print x

This will fail under powershell or cmd (INSIDE VSCODE ONLY)
If you run it in a separate CMD or Powershell window (not under vscode) it succeeds

@brettcannon
Copy link
Member

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).

@lock lock bot locked as resolved and limited conversation to collaborators Jul 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants