Hi
I’m trying to use the function os.execv to execute a batch script within my Python script. Second argument for os.execv shall be a tuple or a list and I test to send tuple or a list as second argument, but nothing works, I get different type of error message.


mpathTotest = 'D:\projects\PythonBuild\test.bat'
argList = ("argument 1","argument 2","argument 3")
os.execv(mpathTotest, argList(1))

Erro message:
os.execv(self.mpathTotest, argList(1))
TypeError: 'tuple' object is not callable

******************************************************
argList = ["argument 1","argument 2","argument 3"]
os.execv(mpathTotest, argList[1])

Error message:
os.execv(self.mpathTotest, argList[1])
TypeError: execv() arg 2 must be a tuple or list

Anyone how has any idea about what the problem is?

Note that argList[1] does not give list as result.
Try:
os.execv(mpathTotest, ["argument 2"])
or:
os.execv(self.mpathTotest, [argList[1]])

Thanks guys, I even managed to send some argument to my Batch program.


[os.execvp(pathToGet, [string, self.mPathToProject, self.mPathToSvnDir, self.mProjecName])]