问题
There's a large number of examples of using your user/pass as credentials to connect to the p4 server using p4python, but very little describing how to use a p4ticket. It's unclear how to use a p4tickets file with p4python.
回答1:
It turns out the perforce documentation is really, really precise. The documentation basically says that if the user isn't logged in, then you have to provide a password to login. The flip side of that coin is that if the user is logged in then no password is needed. So, for instance, assume the user is logged in:
>>> p4 -u 'username' login
Then, in your p4python script, the following will connect:
p4con = P4.P4()
p4con.user = 'username'
p4.con.connect()
The p4python connection will naturally use the ~/.p4tickets file.
来源:https://stackoverflow.com/questions/48210143/how-to-use-p4tickets-with-p4python