Python Interactive passes subprocess arguments to node instead of the provided executable
See original GitHub issueEnvironment data
- VS Code version: 1.29.1
- Extension version: 2018.10.1
- OS and version: Windows 10 64 Bit
- Python version: Anaconda 3, Python 3.7, 64 Bit
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
- Relevant/affected Python packages and their versions: subprocess
Actual behavior
When the following code is run, which is supposed to start orca
(Electron application from Plotly), the arguments are instead passed to node
e.g. node --help
output is printed, but only if the code is run in the Python Interactive Pane (using Run Cell). This also happens with other arguments than --help
, but not with other executables, e.g. code
, conda
and others work as expected.
import subprocess
res = subprocess.run(
args=[<path_to_orca_executable>, '--help'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
print(res.stdout)
The problem also happens when I connect to the Jupyter Notebook instance launched by VS Code in my Browser, but it does not happen with a jupyter notebook instance launched in the Anaconda Terminal, nor does it happend in a REPL, when launched as a file, or in a qtconsole.
Expected behavior
Orca is run with the provided arguments.
Steps to reproduce:
- Install orca
conda install -c plotly plotly-orca
- Execute above code inside a Python Interactive Pane in Code, using Run Cell
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
None.
Output from Console
under the Developer Tools
panel (toggle Developer Tools on under Help
)
console.ts:134 [Extension Host] Python Extension: Error: ENOENT: no such file or directory, open 'C:\Users\<username>\.vscode\extensions\ms-python.python-2018.10.1\out\client\datascience\defaultTheme.json'
t.log @ console.ts:134
t._logExtensionHostMessage @ extensionHost.ts:437
(anonymous) @ extensionHost.ts:244
emitTwo @ events.js:126
emit @ events.js:214
emit @ internal/child_process.js:772
_combinedTickCallback @ internal/process/next_tick.js:141
_tickCallback @ internal/process/next_tick.js:180
console.ts:134 [Extension Host] Python Extension: [I 16:40:00.286 NotebookApp] JupyterLab extension loaded from C:\Users\<username>\Anaconda3\lib\site-packages\jupyterlab
console.ts:134 [Extension Host] Python Extension: [I 16:40:00.286 NotebookApp] JupyterLab application directory is C:\Users\<username>\Anaconda3\share\jupyter\lab
console.ts:134 [Extension Host] Python Extension: [I 16:40:00.290 NotebookApp] Serving notebooks from local directory: C:\Users\<username>\AppData\Local\Temp
console.ts:134 [Extension Host] Python Extension: [I 16:40:00.290 NotebookApp] The Jupyter Notebook is running at:
[I 16:40:00.290 NotebookApp] http://localhost:8888/?token=3d93585235d8531034b0571a9462f8dd19708771c2d1c4bd
[I 16:40:00.290 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
console.ts:134 [Extension Host] Python Extension: [C 16:40:00.299 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=3d93585235d8531034b0571a9462f8dd19708771c2d1c4bd
console.ts:134 [Extension Host] Python Extension: [I 16:40:00.617 NotebookApp] Kernel started: 20c2be11-5288-4dce-806f-dd44b35f1ace
console.ts:134 [Extension Host] Starting WebSocket: ws://localhost:8888/api/kernels/20c2be11-5288-4dce-806f-dd44b35f1ace
console.ts:134 [Extension Host] Python Extension: [I 16:40:01.650 NotebookApp] Adapting to protocol v5.1 for kernel 20c2be11-5288-4dce-806f-dd44b35f1ace
console.ts:134 [Extension Host] Kernel: connected (20c2be11-5288-4dce-806f-dd44b35f1ace)
console.ts:134 [Extension Host] Python Extension: Execute for import pandas as pd
import numpy
%matplotlib inline
import matplotlib.pyplot as plt silently finished.
console.ts:134 [Extension Host] Python Extension: Execute for %cd "c:\Users\nille\Documents\Python Scripts\Pyplot" silently finished.
console.ts:134 [Extension Host] Python Extension: [I 16:40:53.197 NotebookApp] 302 GET /?token=3d93585235d8531034b0571a9462f8dd19708771c2d1c4bd (::1) 0.00ms
console.ts:134 [Extension Host] Python Extension: [I 16:41:10.171 NotebookApp] Creating new notebook in
console.ts:134 [Extension Host] Python Extension: [I 16:41:11.718 NotebookApp] Kernel started: d3a5e5ef-ed29-4f99-9426-b157731b8fdd
console.ts:134 [Extension Host] Python Extension: [I 16:41:12.537 NotebookApp] Adapting to protocol v5.1 for kernel d3a5e5ef-ed29-4f99-9426-b157731b8fdd
I have also posted an issue at orca’s GitHub because I am unsure what is at fault here: https://github.com/plotly/orca/issues/149
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
I don’t like guessing what other packages might or might not do.
I agree with @rchiodo - side effects should be kept minimal. This issue is now documented here, and a workaround does exist by clearing it yourself. Python packages that rely on launching external processes might want to handle this themselves if the application they want to launch does not work with that environment variable.
This extension is not at fault here. I assume VScode itself has a reason for setting this environment variable.
@DonJayamanne you could open an issue at VScode to discuss this further.