Python session 4 subprocess by GOPAL.A
11
Python Execute Unix / Linux Command l There are two modules in python to excute the linux commands. l 1. os module l 2. subprocess module
-
Upload
navaneethan-naveen -
Category
Education
-
view
102 -
download
3
Transcript of Python session 4 subprocess by GOPAL.A
![Page 1: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/1.jpg)
Python Execute Unix / Linux Command
l There are two modules in python to excute the linux commands.
l 1. os module l 2. subprocess module
![Page 2: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/2.jpg)
l syntax:
l subprocess.call(args, *, stdin=None, stdout=None, stderr=None, shell=false)
![Page 3: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/3.jpg)
l PASSING ARGUMENTS
![Page 4: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/4.jpg)
![Page 5: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/5.jpg)
l SUBPROCESS.POPEN( ) - STDOUT AND STDERR
![Page 6: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/6.jpg)
l Popen.communicate() interacts with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached.
![Page 7: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/7.jpg)
![Page 8: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/8.jpg)
![Page 9: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/9.jpg)
![Page 10: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/10.jpg)
SHELL VALUE
![Page 11: Python session 4 subprocess by GOPAL.A](https://reader035.fdocuments.in/reader035/viewer/2022062513/556f7252d8b42a9d338b5076/html5/thumbnails/11.jpg)