I have got a utility "sock" which is C executable (under linux) on my machine. It acts like a server or client based on the arguments passed at the command line. I want to run it through a python script.
I am using the subprocess call function to execute the C executable.
I am making the call as follows:
import subprocess as sp sp.call("python "+str, shell = True) [icode] where str = "/root/sock_dir/sock-0.3.2/src/sock"
But the python script is not compiling and it is giving the following error:
str = /root/sock_dir/sock-0.3.2/src/sock -u -s 5555 File "/root/sock_dir/sock-0.3.2/src/sock", line 1
SyntaxError: Non-ASCII character '\xb1' in file /root/sock_dir/sock-0.3.2/src/sock on line 2, but no encoding declared; see details here
Could any one please tell me how to run this C utility in Python?
Edited 4 Years Ago by Reverend Jim: Fixed formatting