473,473 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Perforce p4c.run("print" error - AttributeError: OutputBinary

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
http://public.perforce.com/guest/rob...hon/index.html
p4c = p4.P4()
p4c.port = "perforce.ic.ncs.com:1424"
p4c.user = "perrk9"
p4c.parse_forms()
p4c.connect()
path = "//practice/perrk9/..."
localTemp = "c:\perforce_temp_dir\\"
first = p4c.run( "counter", "galloway_deploy" )[0]
# here 'last_change_record' is a dictionary
last_change_record = p4c.run( "changes", "-m", "1", path )[0]
print "last change record"
print last_change_record
last = last_change_record['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(changed_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)

Mar 28 '06 #1
2 2832
I received a response from Robert Cowham ( the author of the API):

The problem is that something like print was only expected to be done
for text files not binary.

You could try editing p4.py and add a method similar to:

def OutputText(self, text):
"Adds text lines to the output data."
for line in string.split(text, '\n'):
self.output.append(line)

e.g. around line 214 add

def OutputBinary(self, text):
"Adds lines to the output data."
self.output.append(text)
Note: I am sure that Robert will be updating the P4 module for python,
so if you can I would just download the most recent version (I would
give him a couple of days though).

Mar 28 '06 #2
This seemed to fix my problem.

Keith

www.301labs.com

Mar 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: kiqyou_vf | last post by:
does anyone know why this code: if ($query= "SELECT * FROM ryanBlog WHERE entryNum=5"){ print "<p class=../style1>cool</p>"; }else{ print "<p class=../style1>not cool</p>"; } if($run=...
10
by: Jay Chan | last post by:
I keep getting the following error message when I run a serie of SQL commands: Server: Msg 9002, Level 17, State 6, Line 15 The log file for database 'tempdb' is full. Back up the transaction...
3
by: Anthony Liu | last post by:
We know that if we do print '\a' the bell will sound. Now, why do I hear the sound on my local machine when I run a python script on a remote host? I understand if I hear it when I do
3
by: Gavin Kreuiter | last post by:
I am looking for some advice on how to debug a program when the debugger "print" command actually clears the corruption. This is not the usual non-initialised memory problem, because the program...
8
by: Eric Lilja | last post by:
As the title, says: Why doesn't the following program print Hi Charles<newline> when run? #include <stdarg.h> #include <stdio.h> static void va_arg_example(const char *format, ...) { va_list...
7
by: Mathew Butler | last post by:
I'm investigating an issue I have when pulling data back from MS access I'm retrieving all rows from a column in a table of 5000 rows - accessing a column of type "memo" ( can be 65353 character...
13
by: Vincent Delporte | last post by:
Hi I'm a Python newbie, and would like to rewrite this Perl scrip to be run with the Asterisk PBX: http://www.voip-info.org/wiki/view/Asterisk+NetCID Anyone knows if those lines are...
4
by: Gilles Ganault | last post by:
Hello I'm puzzled as to why PHP (5) prints this (under FreeBSD 6.3): ========= #!/usr/local/bin/php <?php $dbh = new PDO("sqlite:test.sqlite"); $sql = "CREATE TABLE IF NOT EXISTS calls...
0
by: Matt Nordhoff | last post by:
Barak, Ron wrote: For some reason, when you run "import locale", it's importing wx.locale instead of the "locale" module from the stdlib. However, I have no idea why that would be happening......
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.