Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import time
- print("hello")
- #import subprocess
- #MyOut = subprocess.Popen(['gnome-terminal','--command=python3 test2.py'],
- # stdout=subprocess.PIPE,
- # stderr=subprocess.STDOUT)
- #print(MyOut.pid)
- #time.sleep(4)
- #stdout,stderr = MyOut.communicate()
- #print(stdout)
- #print(stderr)
- import os, time
- pipe_path = "/tmp/mypipe"
- if not os.path.exists(pipe_path):
- os.mkfifo(pipe_path)
- # Open the fifo. We need to open in non-blocking mode or it will stalls until
- # someone opens it for writting
- pipe_fd = os.open(pipe_path, os.O_RDONLY | os.O_NONBLOCK)
- with os.fdopen(pipe_fd) as pipe:
- while True:
- message = pipe.read()
- if message:
- print("Received: '%s'" % message)
- print("Doing other stuff")
- time.sleep(0.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement