-1

This command i got from perforce manual:

p4 group -o group_name | grep -v user_name | p4 group -i

How can i use this command in my script using method p4.run()

Samwise
  • 68,105
  • 3
  • 30
  • 44
Darshan Jain
  • 5
  • 1
  • 5

1 Answers1

1

There's an example in the P4Python docs of how to update a spec:

https://www.perforce.com/perforce/r14.2/manuals/p4script/python.p4.html#python.p4.save_spectype

From looking at other examples it sounds like a multi-line field (e.g. the Users field in the group spec) is represented in the spec dict as a list. So I think what you want is something like:

from P4 import P4, P4Exception
p4 = P4()

try:
  p4.connect()
  group = p4.fetch_group( "group_name" )
  group[ "Users" ].remove( "user_name" )
  p4.save_group( group )

except P4Exception:
  for e in p4.errors:
    print e

finally:
  p4.disconnect()
Samwise
  • 68,105
  • 3
  • 30
  • 44