Python non-ascii error for hashtag -
i'm trying call c executable python script. obviously, c code has '#include's @ start , that's what's giving me error when call c executable python. use subprocess.call call executable follows:
>>> subprocess.call([sys.executable,"motor_control","50","1","50","1"])
and following error:
file "motor_control", line 1 syntaxerror: non-ascii character '\xdd' in file motor_control on line 2, no encoding declared; see http://www.python.org/peps/pep-0263.html details 1
line 1, line 2 etc have '#include's. motor_control executable, has numeric arguments 50, 1, 50, 1. ran motor_control terminal , runs fine. googled lot similar errors other non-ascii characters , did not find answer related '\xdd', hashtag @ '#include'. means nobody getting error @ #include's, means i'm missing basic. i'm not sure what.
some other answers here, example: syntaxerror of non-ascii character mention adding
# -*- coding: utf-8 -*-
to start of python script, did not work me. adding
#!/usr/bin/python
also did not work, mentioned else.
i'm running code on pcduino (c code executed in c_environment pcduino (help here)). python , c independently works fine on hardware. there need differently calling c code having #?
thanks in advance
subprocess.call([sys.executable,"motor_control","50","1","50","1"])
the above command translate /usr/bin/python motor_control 50 1 50 1
, executed
so doing passing excutable python interpreter wrong
try this:
subprocess.call(["/pathtoexecutable/motor_control","50","1","50","1"])
Comments
Post a Comment