I'm currently learning how to use the module subprocess
and I just started with my new book. Instantly, I got an error message which I don't understand.
Traceback (most recent call last): File "D:/me/Python/subprocess.py", line 3, in <module> proc = subprocess.Popen(['echo', 'Hello there'], stdout=subprocess.PIPE) File "C:\Python34\lib\subprocess.py", line 859, in __init__ restore_signals, start_new_session) File "C:\Python34\lib\subprocess.py", line 1112, in _execute_child startupinfo) FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden
'Das System kann die angegebene Datei nicht finden' is german for: 'The system can't find the specified file'. Since I'm german myself, I'm not having troubles with german error hanling, but I didn't figure out what is wrong here:
import subprocess proc = subprocess.Popen(['echo', 'Hello there'], stdout=subprocess.PIPE) out, err = proc.communicate() print(out.decode('utf-8'))
In the book they said this code should print 'Hello there' on the screen but for some reason, it doesn't.
What is wrong here? I'm currently using python 3.4.3, if that helps you.