[p4] Python code issue with triggers
Dix, John
JDix at MedManageSystems.com
Fri Sep 21 09:50:50 PDT 2007
Uhm, nevermind. I jumped into this first thing in the morning before I
had my coffee. :-)
________________________________
From: Dix, John
Sent: Friday, September 21, 2007 9:08 AM
To: perforce-user at perforce.com
Subject: Python code issue with triggers
Hello all,
I have written some python code for a trigger:
CheckDesc form-in change "C:\Python25\python.exe
C:\PerforceScripts\CheckDescription.py %formfile%"
And my code executes until it hits this line:
if k[:4] == 'User':
in GetUserList().
When I execute this in the debugger or on its own I get the list of
users, but it fails when called in the trigger. Any ideas?
def GetUserList():
result = {}
Users = []
objCmdFile = None
try:
objCmdFile = os.popen("p4 -G group -o dev", 'r')
except IOError, e:
print "Unable to open %s" % (objCmdFile, e)
try:
result = marshal.load(objCmdFile)
except EOFError, e:
print "Failed the marshal.load by EOFError"
except ValueError, e:
print "Failed the marshal.load by ValueError"
except TypeError, e:
print "Failed the marshal.load by TypeError"
else:
job_users = []
for k in result.keys():
if k[:4] == 'User': # user key format: User0, User1, ...
u = result[k]
print "%s" % u
job_users.append(u)
return Users
def main():
UserList = []
UserList = GetUserList()
sys.exit(1)
return retVal
More information about the perforce-user
mailing list