subprocess.run-0.0.8
توضیحات
The subprocess module extension to run processes.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | subprocess.run-0.0.8 |
| نام | subprocess.run |
| نسخه کتابخانه | 0.0.8 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Sebastian Pawluś |
| ایمیل نویسنده | sebastian.pawlus@gmail.com |
| آدرس صفحه اصلی | https://github.com/xando/subprocess.run |
| آدرس اینترنتی | https://pypi.org/project/subprocess.run/ |
| مجوز | Copyright (c) 2013, Sebastian Pawluś. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. |
==========================
from subprocess import run
==========================
The **subprocess** extension to run processes.
.. code-block:: python
>>> from subprocess import run
>>> run('uname -r').stdout
3.7.0-7-generic
>>> run('uname -a').status
0
>>> print run('rm not_existing_directory').stderr
rm: cannot remove `not_existing_directory': No such file or directory
>>> print run('ls -la', 'wc -l')
14
To use pipe from the shell.
.. code-block:: python
from subprocess import run
run('grep something', data=run.stdin)
.. code-block:: bash
$ ps aux | python script.py
Install
-------
You can install it from PyPi, by simply **pip**:
.. code-block:: bash
$ pip install subprocess.run
to test it, launch **python**
.. code-block:: python
>>> from subprocess import run
Supported platforms
-------------------
* Python2.6
* Python2.7
* Python3.3
* PyPy2.1
Tests
-----
.. image:: https://travis-ci.org/xando/subprocess.run.png?branch=master
:target: https://travis-ci.org/xando/subprocess.run
.. code-block:: bash
>>> python setup.py test
نحوه نصب
نصب پکیج whl subprocess.run-0.0.8:
pip install subprocess.run-0.0.8.whl
نصب پکیج tar.gz subprocess.run-0.0.8:
pip install subprocess.run-0.0.8.tar.gz