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.
Due to the reasons discussed here we will be moving to on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 3000
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], Yahoo [Bot] and 6 guests