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: 13
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!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
Posts: 1992
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 3 guests