问题
I have a scenario where i need to have perforce workspace Client name information. Trying out with script as follows:
import sys
import subprocess
cmd = "p4 info | grep" + """ "Client name" """ +""
print ("p4 command is: ",cmd)
p4 = subprocess.call(cmd)
print( p4)
Where i get out put as :
p4 command is: p4 info | grep "Client name"
Usage: info [-s]
Unexpected arguments.
1
I tried doing as follows too but did not worked:
import sys
import subprocess
p4_info = subprocess.call([sys.executable, "p4 info | grep "Client name""])
I actually want to fetch only Client name information. So, suggest me how i may have that. If there is another way of doing it please suggest. The script will be executed within the workspace and shall return the only Client name:
回答1:
Do:
p4 -Ztag -F %clientName% info
来源:https://stackoverflow.com/questions/47579641/how-to-get-client-name-of-a-perforce-workspace-using-p4-info-from-python-sc