consider portion of Python code(Python 2.7) on Win 7 machine,
toolPath="C:\\Program Files (x86)\\Target Compiler Technologies\\adsp2-12R2\\bin\\WINbin"
This is executed from python script under
C:\dev\bin\toplevel\python
Now, I need to execute a command that runs(compiles and builds a DSP library, .prx is a project file for the library) as
C:\Program Files (x86)\Target Compiler Technologies\adsp2-12R2\bin\WINbin\chessmk.exe ".\..\..\..\dev\lib\adsp2\mylibs.prx -r -s
I am able to do that in cmd.exe shell as
%toolPath%\chessmk.exe "..\..\..\dev\lib\adsp2\mylibs.prx" -r -s
I can do the same in Python as
cmd = '"C:\\Program Files (x86)\\Target Compiler Technologies\\adsp2-12R2\\bin\\WINbin\\chessmk.exe" "C:\\SVN\\ASROmni\\trunk1\\\dev\\lib\\adsp2\\mylibs.prx" -r'
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=False)
But, I have not been able to write similar code for Python, with relative paths and using toolpath variable. for example,
cmd = 'toolPath+"\\chessmk.exe" ".\\..\\..\\..\\dev\\lib\\adsp2\\mylibs.prx" -r -s'
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=False)
gives error:
WindowsError: [Error 2] The system cannot find the file specified
following did not work too:
cmd = '"C:\\Program Files (x86)\\Target Compiler Technologies\\adsp2-12R2\\bin\\WINbin\\chessmk.exe" ".\\..\\..\\..\\dev\\lib\\adsp2\\mylibs.prx" -r'
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=False)
Update: from one of the comments, I tried
cmd = os.path.join(toolPath,"chessmk.exe")+' C:\\SVN\\ASROmni\\trunk1\\\dev\\lib\\adsp2\\mylibs.prx -r'
it works,but the relative path one
cmd = os.path.join(toolPath,"chessmk.exe")+' .\\..\\..\\..\\dev\\lib\\adsp2\\mylibs.prx -r'
still dosn't.
any help.( This is my first day with python, so bear with me)
please note that the cmd should be run from within Python, not invoking shell=True.
Thanks
sedy