简体   繁体   中英

P4python Help Perforce password (P4PASSWD) invalid or unset

I'm using P4Python to connect to a P4 server to retrieve results about some changes.

The ideal command on CLI is:

p4 -p tcp:SERVER:1666 -u USER -P PASSWORD | p4 -p tcp:HOST:1666 -u USER changes /path/...@$PROD_SHA_BUILD,@$SHA_BUILD

So I tried to replicate this via the python API:

    p4 = P4()
    p4.user = str(self.PERFORCE_USER)
    p4.password = str(self.PERFORCE_PASSWORD)
    p4.port = HOST
    p4.connect()
    per_user = "-u '" + str(self.PERFORCE_USER) + "'"
    per_passwd = "-P '" + str(self.PERFORCE_PASSWORD) + "'"
    cmd = "changes"
    tmp = p4.run(cmd,["//depot/se/development/HEAD/sports-navigation/...@823493,@828026",per_user,per_passwd])

Why am I getting the error that P4PASSWD is not defined?

I even added a:

os.environ["P4PASSWD"] = str(self.PERFORCE_PASSWORD)

Thanks.

Did you already try the technique mentioned in here for ticket based authentication?

from P4 import P4
p4 = P4()
p4.user = "Sven"
p4.password = "my_password"
p4.connect()
p4.run_login()

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