diff --git a/.zk/notebook.db b/.zk/notebook.db index b057ca5..0c3d4e1 100644 Binary files a/.zk/notebook.db and b/.zk/notebook.db differ diff --git a/zk/Invoking_the_shell_in_Python.md b/zk/Invoking_the_shell_in_Python.md new file mode 100644 index 0000000..5ebab69 --- /dev/null +++ b/zk/Invoking_the_shell_in_Python.md @@ -0,0 +1,27 @@ +--- +id: cfr4 +title: Invoking_the_shell_in_Python +tags: [python, shell] +created: Monday, April 29, 2024 +--- + +# Invoking the shell_in_Python + +```py +import subprocess + + +try: + process = subprocess.run( + ["timew export"], + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True, + ) + return json.loads(process.stdout) + except subprocess.CalledProcessError as e: + return e.stderr.strip() + + +```