easysh
an easy to execute shell in python
Requirements
Python 3.3 +
Installation
pip install easysh
Usage
from easysh import Shell
output= Shell.exec('ls -l')
print(output)
asyncio
from easysh import Shell
output= await Shell.aexec('ls -l',cwd='/var')
print(output)
Real-time output
from easysh import Shell
with Shell.create('ls -l') as std:
for line in std:
print(line)
asyncio Real-time output
from easysh import Shell
async with Shell.create('ls -l') as std:
async for line in std:
print(line)
execute shell command with timeout
from easysh import Shell
# raise subprocess.TimeoutExpired
await Shell.aexec('python',timeout=3)
error handing
from easysh import Shell, ShellError
try:
Shell.exec("unknown command")
except ShellError as e:
print(e)
capturing the output and error streams
from easysh import Shell
# capturing the output and error streams
with Shell.create("unknown command", raise_on_stderr=False) as std:
output = std.read()
print(output)
print(std.has_errors)
Metadata
Release files for easysh 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| easysh-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / easysh-1.0.0-py3-none-any.whl
| Download URL | easysh-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2e787199bddf1c42c486f82dcc04457678e60aaf4177655bdf15ff456b5c4ef
|
|
BLAKE2b-256 checksum How to use checksums |
3f5e092c1c7c9b95aff3ee17696f269a21ff65210e9dde98d442f6f767b97b20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
|