Login to another user as admin

324 Views Asked by At

As a Perforce administrator, I can log in as another user without a password and perform actions:

p4 login joe
p4 -u joe revert //...

I'd like to do this in a Python script, using P4Python. I've tried setting the user field per this answer:

from P4 import P4
p4 = P4()
p4.user = 'joe'
p4.connect()
p4.run_revert('//...')

and I've tried using something more similar to the command line syntax (per this post):

p4 = P4()
p4.connect()
p4.run_login('joe')
p4.run_revert('//...', user='joe')

Both result in an exception:

P4.P4Exception: [P4#run] Errors during command execution( "p4 revert -k //..." )

[Error]: 'Perforce password (P4PASSWD) invalid or unset.'

Is there a way I can log in as another Perforce user without a password in Python using P4Python?

0

There are 0 best solutions below