0

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.

Shawn Mehan
  • 4,513
  • 9
  • 31
  • 51
Etraud
  • 19
  • 1
  • 5
  • Are you sure that self.PERFORCE_PASSWORD is the correct password for whatever user name self.PERFORCE_USER refers to? – Samwise Aug 07 '15 at 05:56
  • Yes I tested manually – Etraud Aug 07 '15 at 09:01
  • 1
    Have the same experience, with the exception that it works on Windows, but not on Linux. Further, I am using the ticket based authentication. Could it be something with client versions? – RVarttinen Jan 27 '17 at 13:41

1 Answers1

1

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()
ziddarth
  • 1,796
  • 1
  • 14
  • 14
  • Nice! Thanks! First I thought it was about all that settings being pushed in one go but for me it was actually just the login command that didn't work via `p4.run('login')` Seems you HAVE to use `p4.run_login()`! – ewerybody May 26 '20 at 12:08
  • Really weird that you have to use run_login... What's the point of connect() then? LOL – Ryan Glenn Jan 02 '22 at 17:20