Hi,
I am trying to do the following command in Python:
traceroute -A google.es | cat > test.txt
So, what I've done is the following:
tracerouteProcess = subprocess.Popen(["traceroute","-A","google.es"]. stdout=subprocess.PIPE) f = open("test.txt", "w")
Sending the output from traceroute to a file
using cat because the OS of host (SELinux) where the script will be executed
does not allow directly redirecting the traceroute output to a file.
catProcess = subprocess.Popen(["cat"], stdin=tracerouteProcess.stdout, stdout=f) catProcess.communicate() string = f.read() traceroute = trparse.loads(string)
And it raises the following error:
dest_name = match_dest.group(1)
AttributeError: 'NoneType' object has no attribute 'group'
I will appreciate some kind of example to see what I am doing wrong.
Thanks in advance
Hi,
I am trying to do the following command in Python:
traceroute -A google.es | cat > test.txtSo, what I've done is the following:
tracerouteProcess = subprocess.Popen(["traceroute","-A","google.es"]. stdout=subprocess.PIPE) f = open("test.txt", "w")Sending the output from traceroute to a file
using cat because the OS of host (SELinux) where the script will be executed
does not allow directly redirecting the traceroute output to a file.
catProcess = subprocess.Popen(["cat"], stdin=tracerouteProcess.stdout, stdout=f) catProcess.communicate() string = f.read() traceroute = trparse.loads(string)And it raises the following error:
dest_name = match_dest.group(1)
AttributeError: 'NoneType' object has no attribute 'group'
I will appreciate some kind of example to see what I am doing wrong.
Thanks in advance