"""
Demo of calling subprocesses.


Links
-----

- https://docs.python.org/3/library/io.html

- https://docs.python.org/3/library/subprocess.html
"""

from subprocess import call


def call_and_check_errors():
	call_args = ('wc', '-l', 'my_file')

	call_args_str = ' '.join(call_args)
	print(call_args_str)

	result = call(call_args)

	if 0 != result:
		print('Error during call.')


if '__main__' == __name__:
	call_and_check_errors()

@@ -167,20 +167,65 @@
  import 
-call
+CalledProcessError, call, check_output%0Aimport sys
 %0A%0A%0Adef c
@@ -267,28 +267,27 @@
 = ('
-wc', '-l', 'my_file'
+touch', sys.argv%5B0%5D
 )%0A%0A%09
@@ -421,16 +421,260 @@
 ll.')%0A%0A%0A
+def call_and_get_output():%0A%09call_args = ('wc', '-l', sys.argv%5B0%5D)%0A%0A%09call_args_str = ' '.join(call_args)%0A%09print(call_args_str)%0A%0A%09try:%0A%09%09stdout = check_output(call_args)%0A%09%09print(stdout)%0A%09except CalledProcessError:%0A%09%09print('Error during call.')%0A%0A%0A
 if '__ma
@@ -702,23 +702,21 @@
 all_and_
-check_errors
+get_output
 ()%0A

Add call subprocess and print output