Hi all,
I am getting an error message when trying to use the P4 print command
via the python api for perforce.
Anytime that I run p4c.run("print" ,"-q", eachFile), I keep getting an
error message: "AttributeError : OutputBinary."
Here is my code below: Please Help.
import p4
#import perforce module
#For complete API see
p4c = p4.P4()
p4c.port = "perforce.ic.nc s.com:1424"
p4c.user = "perrk9"
p4c.parse_forms ()
p4c.connect()
path = "//practice/perrk9/..."
localTemp = "c:\perforce_te mp_dir\\"
first = p4c.run( "counter", "galloway_deplo y" )[0]
# here 'last_change_re cord' is a dictionary
last_change_rec ord = p4c.run( "changes", "-m", "1", path )[0]
print "last change record"
print last_change_rec ord
last = last_change_rec ord['change']
print "last \n"
print last
status_dict = { "right only" :"add", "left only" :"delete", "content"
:"edit", "identical" :"no change" }
result = p4c.run( "diff2", "-q", path + "@" + first , path + "@" + last
)
# result is an Array, each element is a Dictionary
#Find out which files were add/edited/deleted and throw them into lists
deploy = [] # add/edit list
undeploy = [] # delete list
for changed_file in result:
action = status_dict[ changed_file['status'] ]
print action
if ((action =='add') or (action == 'edit')):
print "Changed file = "
print changed_file['depotFile']
deploy.append(c hanged_file['depotFile']) #appending each file to our
'deploy' list
elif action == delete:
undeploy.append (changed_file['depotFile']) #appending each file to
our 'undeploy' list
#print the deploy list
print "deploy list"
print deploy
for eachFile in deploy :
print eachFile
file = p4c.run("print" ,"-q", eachFile)
I am getting an error message when trying to use the P4 print command
via the python api for perforce.
Anytime that I run p4c.run("print" ,"-q", eachFile), I keep getting an
error message: "AttributeError : OutputBinary."
Here is my code below: Please Help.
import p4
#import perforce module
#For complete API see
p4c = p4.P4()
p4c.port = "perforce.ic.nc s.com:1424"
p4c.user = "perrk9"
p4c.parse_forms ()
p4c.connect()
path = "//practice/perrk9/..."
localTemp = "c:\perforce_te mp_dir\\"
first = p4c.run( "counter", "galloway_deplo y" )[0]
# here 'last_change_re cord' is a dictionary
last_change_rec ord = p4c.run( "changes", "-m", "1", path )[0]
print "last change record"
print last_change_rec ord
last = last_change_rec ord['change']
print "last \n"
print last
status_dict = { "right only" :"add", "left only" :"delete", "content"
:"edit", "identical" :"no change" }
result = p4c.run( "diff2", "-q", path + "@" + first , path + "@" + last
)
# result is an Array, each element is a Dictionary
#Find out which files were add/edited/deleted and throw them into lists
deploy = [] # add/edit list
undeploy = [] # delete list
for changed_file in result:
action = status_dict[ changed_file['status'] ]
print action
if ((action =='add') or (action == 'edit')):
print "Changed file = "
print changed_file['depotFile']
deploy.append(c hanged_file['depotFile']) #appending each file to our
'deploy' list
elif action == delete:
undeploy.append (changed_file['depotFile']) #appending each file to
our 'undeploy' list
#print the deploy list
print "deploy list"
print deploy
for eachFile in deploy :
print eachFile
file = p4c.run("print" ,"-q", eachFile)
Comment