How to open a new pop up /bin/sh through subprocess python code (similar to start cmd /c)

Viewed 13

To run a python script in a new docker terminal which will be popup through code.

  def listenToChannel(channel,groupMemberId,userName):
connNotification.cursor().execute("LISTEN " + channel + ";")
sleep(10)
while True:
        sleep(2)
        connNotification.poll()
        while connNotification.notifies and globalVariables.notifcation == False:
            json_object = ''
            notify = ''
            if "groupmemberId" in str(connNotification.notifies) and channel.lower() in str(connNotification.notifies):
                notify = connNotification.notifies.pop()
                json_object = json.loads(notify.payload)
                try:
                    if json_object["groupmemberId"] != groupMemberId:
                        subprocess.Popen("$docker exec bash -c 'python responseNotificationPopUp.py '" +"\'"+ channel + " " + userName + " " + json_object["message"] + "\'" , shell=True)
                except:
                    continue
            elif channel.lower() in str(connNotification.notifies):
                connNotification.notifies.pop()

enter image description here

0 Answers
Related