Python Forum
Create process to control python script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create process to control python script
#1
Hello you all:

I have a question with which approach and resources I have to make the following task:

There is a script in my Ubuntu machine that is called act.py, when act.py runs it performs a few tasks and while performing them, the process has a input() function to wait for operator/user input to continue the task.

My goal is to run a script named main.py that makes processes that executes act.py, when input() raised, the main.py will get notified (which is monitoring whole processes) and let me control the act.py (process) I chose or which raised a flag.

What I tried:

I tried pty.openpty() function which returns me master,slave(fd) but I can't make the terminal take over that fd and interact with it.
fork() will duplicate my master which is really not needed in my opinion.
Using pexpect is easy solution but I can't learn from it where my goal is really study how to get to level where I can control -> take over shells.
Could not really make combination of pty/tty/termios hope someone can clarify what is the best approach addressing this task.
I hope someone can help me with this as I am very enthusiast solving this as it's a big project for my college.

Thank's a lot for helpers.
Reply


Messages In This Thread
Create process to control python script - by kobibi11 - Jun-07-2020, 07:49 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Re-write BASH script to Python script popi75 5 2,492 Apr-30-2021, 03:52 PM
Last Post: metulburr
  How to simulate this block diagram with python control library? nugrohoav 1 6,473 May-21-2017, 12:39 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020