Run a command within python
Project description
run-cmd
Run a command within python
Install it
pip install python-run-cmd
# pip install git+https://github.com/ffreemt/run-cmd
# poetry add git+https://github.com/ffreemt/run-cmd
# git clone https://github.com/ffreemt/run-cmd && cd run-cmd
Use it
from python_run_cmd import run_cmd
ret = run_cmd("ls -l")
if ret.returncode:
print("Failed")
else:
print("OK")
Raise an exception when errors occur. This may come handy sometimes.
from python_run_cmd import run_cmd
ret = run_cmd("lsss -l")
# 'lsss' is not recognized as an internal
# or external command, operable program or batch file.
Set raise_stderr=False to ignore errors
from python_run_cmd import run_cmd
ret = run_cmd("lsss -l", raise_stderr=False)
if ret.returncode:
print("Failed")
else:
print("OK")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_run_cmd-0.1.0.tar.gz
(3.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_run_cmd-0.1.0.tar.gz.
File metadata
- Download URL: python_run_cmd-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.10 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc1410501b62d979c160fb663777fefa9014c1faa997b35f0d50e9c3de1efe54
|
|
| MD5 |
5e5051b7fd0648763eb4553ae91f4466
|
|
| BLAKE2b-256 |
d87f1a0b266794b40ed5e345600fb86559feba3a27d20cc18445aa376e906499
|
File details
Details for the file python_run_cmd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: python_run_cmd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.10 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b42c35ae0a1e0fab56bea53cb6eea77c1b735832b92264b65dad44dd50a1045
|
|
| MD5 |
617ea804fda9c12c77e4937d6555d1e6
|
|
| BLAKE2b-256 |
a4ea033b46dfcb71f3cbbed012961ac84a8a7d0f5a5903742b7e9d87543faf24
|