ipython / ipython/ipykernel

Subprocess command with pipes exception

Offen
#979 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
734
Forks
412
Ø Merge
1 T. 5 Std.
Gemergte PRs (30 T.)
8

Beschreibung

When running a system command in ipyterminal exceptions being thrown and no output being displayed. However, when running in a normal python terminal, there are no issues. Running python 3.8.3. Running ipyterminal in vs code jupyter notebook.

```
from subprocess import run, PIPE, Popen, check_output
cmd = "ls | grep test"
output = check_output(cmd)
print(output.decode('utf-8'))
```

Error in ipyterminal

FileNotFoundError Traceback (most recent call last)
C:\Temp/ipykernel_13876/3338296859.py in
1 from subprocess import run, PIPE, Popen, check_output
2 cmd = "ls | grep test"
----> 3 output = check_output(cmd)
4 #print(output.stdout.decode('utf-8'))

c:\Users\S279376\Miniconda3\envs\analytics\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)
413 kwargs['input'] = empty
414
--> 415 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
416 **kwargs).stdout
417

c:\Users\S279376\Miniconda3\envs\analytics\lib\subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
491 kwargs['stderr'] = PIPE
492
--> 493 with Popen(*popenargs, **kwargs) as process:
494 try:
495 stdout, stderr = process.communicate(input, timeout=timeout)

c:\Users\S279376\Miniconda3\envs\analytics\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
856 encoding=encoding, errors=errors)
857
...
-> 1311 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
1312 # no special security
1313 None, None,

FileNotFoundError: [WinError 2] The system cannot find the file specified

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Run the provided check_output example in the VS Code Jupyter notebook on Windows, then compare it with a normal Python terminal. Trace the subprocess behavior around the pipe and verify that the command completes without FileNotFoundError and displays its output.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
jupyter-notebook, python
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.