简体   繁体   中英

TFS CLI commands from python script

I am writing some python extension scripts to integrate TFS version control functionality to our tool. The process that we follow is something like this,

1, The TFS.exe cli commands are written to a batch file. 2, The batch file is executed using python subprocess.call(batch_file, shell=True)

The issue that I have is that, these dialog does not come up when the batch files are run from python. I just tested the cli commands by running the commands from the batch file in command prompt and they do bring up the expected dialog (eg - create / edit work-spaces etc.).

Can somebody shed some light? Am I doing anything wrong, or am I missing something while invoking tf.exe (I don't have the /noprompt switch in any of my commands). The return code is 100 which implies nothing succeeded. The interesting part is the same command succeeds when I run it in command prompt, the command prompt by default runs the CLI commands under %USERPROFILE% directory.

If I try executing some dummy TortoiseSVN cli commands from the batch file in the same manner they do bring up the respective TortoiseSvn dialog. So I assume its not a problem with the batch file executing from Python.

Could it be a problem with the user rights..?

Thanks and Regards, Joe.

I use "os.system" to call the bat file, it works.

import os
os.system("c:\\xxx.bat")

Code in bat file:

cd C:\Users\XXX\Source\Workspaces\XXX\XXX
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\tf.exe" view *.cs
pause

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM