Autosave: 2024-04-29 17:50:04
This commit is contained in:
parent
e6c654c913
commit
a784a952d4
2 changed files with 27 additions and 0 deletions
BIN
.zk/notebook.db
BIN
.zk/notebook.db
Binary file not shown.
27
zk/Invoking_the_shell_in_Python.md
Normal file
27
zk/Invoking_the_shell_in_Python.md
Normal file
|
@ -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()
|
||||
|
||||
|
||||
```
|
Loading…
Add table
Reference in a new issue