Programming/python [python][ubus] 간단히 ubus 보내고 받는 예제 - ubus-listen.py import ubus ubus.connect("/var/run/ubus.sock") if not ubus: print("ubus is empty or broken") exit() def callback(event, data): print("===== event %s received with value: %s" % (event, data)) ubus.listen(("mevent", callback)) ubus.loop() ubus.disconnect() ubus-send.py import ubus ubus.connect("/var/run/ubus.sock") if not ubus: print('ubus empty') exit(); print("sending event mevent") ubus.send("mevent", {"some": "data"}) ubus.disconnect() 실행 결과 # python3 ubus-listen.py & # python3 ubus-send.py sending event mevent ===== event mevent received with value: {'some': 'data'} 공유하기 게시글 관리 구독하기sr's lair 저작자표시 'Programming > python' 카테고리의 다른 글 [python] os 종류 확인하기 (0) 2020.08.11 [python] 설치된 패키지 확인 (0) 2020.07.29 [python] 서로 다른 경로에 있는 모듈 import 하기 (0) 2020.07.22 [python][ubus] failed to connect to the "ubus" socket var/run/ubus.sock (0) 2020.07.02 VSCode 상에서 이미 설치된 모듈을 찾을 수 없다고 할 때 해결 방법 (2) 2020.06.04 Contents 당신이 좋아할만한 콘텐츠 [python] 설치된 패키지 확인 2020.07.29 [python] 서로 다른 경로에 있는 모듈 import 하기 2020.07.22 [python][ubus] failed to connect to the "ubus" socket var/run/ubus.sock 2020.07.02 VSCode 상에서 이미 설치된 모듈을 찾을 수 없다고 할 때 해결 방법 2020.06.04 댓글 0 + 이전 댓글 더보기