Jan-27-2018, 02:30 PM
(Jan-27-2018, 09:09 AM)Barrowman Wrote: Sorry wavic when I do
Python Code: (Double-click to select all)
1
2
command = "cat /home/norman/khconf/second.txt | sort | uniq > /home/norman/khconf/third.txt".split()
subprocess.call(command)
I get
Error:
cat: '|': No such file or directory
cat: sort: No such file or directory
cat: '|': No such file or directory
cat: uniq: No such file or directory
cat: '>': No such file or directory
This is because the call method doesn't use the shell to execute a command. You have to pass
shell=True
as a parameter to the method. But this is not safe.