일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 라즈베리파이
- 홈어시스턴트
- homeassistant
- IOT Core
- STM32
- 전기차충전기
- thread
- 에버온
- 파이썬
- 보안
- 완속충전기
- YMODEM
- 플라스크
- dynamodb
- raspberry
- Android
- 서버리스
- everon
- AWS
- esp8266
- 급속충전기
- 디자인패턴
- lambda
- flask
- 펌웨어
- OCPP
- 안드로이드
- 전기차
- 전기차충전
- 충전기
Archives
- Today
- Total
Louie NRT Story
[Raspberry Pi] Subprocess(Run new process) 본문
반응형
Writed on 28 OCT 2019
Device: Raspberry Pi 3
Raspbian Version: 2019-09-26-raspbian-buster-full.zip
1. exec
if __name__ == "__main__":
exec(open("test01.py").read())
2. subprocess
import os
import signal
import subprocess
if __name__ == "__main__":
proc = subprocess.Popen("python test01.py", shell=True)
pid_ = proc.pid
os.system('kill -9 %s' %pid_)
Reference: https://docs.python.org/3/library/subprocess.html
subprocess — Subprocess management — Python 3.8.0 documentation
subprocess — Subprocess management Source code: Lib/subprocess.py The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace several older modules and fu
docs.python.org
반응형
'에너지' 카테고리의 다른 글
[Raspberry Pi] Chromium-browser Autostart (0) | 2019.11.04 |
---|---|
[Raspberry Pi] php web server (0) | 2019.11.04 |
[Raspberry Pi] Supervisor (0) | 2019.10.28 |
[Raspberry Pi] Watchdog (0) | 2019.10.28 |
[Raspberry Pi] Change booting image and remove log (0) | 2019.10.23 |
Comments