Hi guys,
I'm learning python and perl and i was trying to run from python a perl script using the subprocess module.
I have an issue that i don't understand regarding this.
I run this code:
#!/usr/bin/python
import subprocess
p2 = subprocess.Popen(["grep", "print", "first.pl"],stdout=subprocess.PIPE)
output2 = p2.communicate()[0]
print output2
p1 = subprocess.Popen(["perl","first.pl"],stdout=subprocess.PIPE)
output1 = p1.comunicate()[0]
print output1
First part : run grep, works as expected, i can get the ouput and display it.
The second one, when i actually want to run the perl script and get the output throws me an error :
Traceback (most recent call last):
File "./test.py", line 9, in ?
output1 = p1.comunicate()[0]
AttributeError: 'Popen' object has no attribute 'comunicate'
I don't understand why this happens since the code is similar. Can someone enlight me?
Thanks,
Ionut