We have python version - 2.7.5 on my Linux machine - redhat 7.3
I write this simple script in order to use sed to replace string in file
more test.py
#!/usr/bin/env python
import subprocess
subprocess.call("sed s'/2.6/2.6.4/g' /tmp/file.xml")
but we got
Traceback (most recent call last):
File "./test.py", line 5, in <module>
subprocess.call("sed s'/2.6/2.6.4/g' /tmp/file.xml")
File "/usr/lib64/python2.7/subprocess.py", line 524, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
what is wrong with the python script ?
more file.xml
2.6.0.3-8
2.6will match2a6,276etc... use2\.6instead