Subprocess with variables & Command from different class
Posted
by
Pastelinux
on Stack Overflow
See other posts from Stack Overflow
or by Pastelinux
Published on 2011-01-03T19:44:55Z
Indexed on
2011/01/03
19:53 UTC
Read the original article
Hit count: 181
source: http://pastebin.com/utL7Ebeq
My thinking is that if i run from controller class "main" it will allow me to take the "data" from Class "model", def "filename". It doesn't seem to work. As you can see below what i mean
class Controller:
def __init__(self):
self.model = Model()
self.view = View()
def main(self):
data = self.model.filename()
self.view.tcpdump(data)
class View:
def tcpdump(self, command):
subprocess.call(command.split(), shell=False)
When i run my code i get this error:
subprocess.call(command.split(), shell=False)
AttributeError: 'NoneType' object has no attribute 'split'
My guess means that its not picking up command (look at source for reference) or that its not getting command with variables. But i know the error when variables are not being picked up so i don't think it is that.
My question is, from what i have thus far, how do i from "class view" grab "command" for my subprocesses to run.
Thanks~
John Riselvato
© Stack Overflow or respective owner