How to control popen within a class

This is the place for queries that don't fit in any of the other categories.

How to control popen within a class

Postby tbaror » Mon Sep 30, 2013 7:10 pm

Hi All,

I am writing a class to do some tasks with shell utility (tshark) using subprocess popen
My problem is that i am stacked actually don't have idea how to interact with method i created that running the popen and for example kill or terminate it , shown in code below.
So if someone could assist me or have another idea will be great
Please advice

Code: Select all
import subprocess

class TsharkCtrl():
    def __init__(self,):
    def run(self,NIC_LISTEN,FL_TRNAME,OPS_WR=None):
        if OPS_WR == None:
            tsharkCall = ["tshark","-i" ,NIC_LISTEN, "-w" + FL_TRNAME]
            tsharkProc = subprocess.Popen(tsharkCall,executable="C:/Program Files/Wireshark/tshark.exe")
    def killProc(self):
        ?????? :?:

Posts: 19
Joined: Sun Jul 07, 2013 8:06 pm

Re: How to control popen within a class

Postby micseydel » Mon Sep 30, 2013 10:13 pm

You can use the code
Code: Select all

to find out methods of that object. You should check out kill() and terminate() especially.
Join the #python-forum IRC channel on for off-topic chat!

Please prefer not to PM members. The point of the forum is so that anyone can benefit. We don't want to help you over PMs/emails/Skype chats that others can't benefit from :)
User avatar
Posts: 2916
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Coding Help

Who is online

Users browsing this forum: Bing [Bot] and 5 guests