A
abcd
I have a class which extends 'file' ....
class MyFile(file):
def __init__(self, fname, mode='r'):
file.__init__(self, fname, mode)
def write(self, str):
print "writing a string"
file.write(self, str)
def writelines(self, lines):
print "writing lines"
file.writelines(self, lines)
I use this with subprocess....
f = MyFile('out.txt', 'w')
p = subprocess.Popen(cmd, stdout=f)
.....and I can see that stuff goes into out.txt.....however, I never see
"writing a string" or "writing lines" from the class MyFile.
Any ideas what methods the stdout (and I guess stderr) of Popen objects
from subprocess call?
Any suggestions on how to find out? I did try adding to MyFile....
def __call__(self, *args):
print "calling:", args
return file.__call__(self, *args)
but I never see that either.
thanks
class MyFile(file):
def __init__(self, fname, mode='r'):
file.__init__(self, fname, mode)
def write(self, str):
print "writing a string"
file.write(self, str)
def writelines(self, lines):
print "writing lines"
file.writelines(self, lines)
I use this with subprocess....
f = MyFile('out.txt', 'w')
p = subprocess.Popen(cmd, stdout=f)
.....and I can see that stuff goes into out.txt.....however, I never see
"writing a string" or "writing lines" from the class MyFile.
Any ideas what methods the stdout (and I guess stderr) of Popen objects
from subprocess call?
Any suggestions on how to find out? I did try adding to MyFile....
def __call__(self, *args):
print "calling:", args
return file.__call__(self, *args)
but I never see that either.
thanks