[p4python] Output of p4 print chunked into array?

Ling Lo linglo at gmail.com
Sun Nov 9 23:13:19 PST 2014


Does this mean it's affected by the p4 configure filesys.bufsize and
possible lbr.bufsize?

On 7 November 2014 11:00, Jan Van Uytven <juytven at perforce.com> wrote:

> Thanks guys.  Is this in the documentation anywhere?  It's not mentioned
> either in the scripting docs or in the 'p4 print' reference.
>
> - Jan
>
> Sven Erik Knop writes:
>
> > Hi Jan,
> >
> > As Goeff said, the server sends 4K blocks of content back, so the APIs
> return them as separate strings.
> > If you use P4.run_print() instead of P4.run(“print”), P4Python clumps
> the chunks together into a single continuous string.
> > This should make your customers life much easier.
> >
> > Cheers
> >
> > Sven Erik
> >
> > PS: Time for a blog article?
> >
> >> On 6 Nov 2014, at 22:12, Geoff Nicol <gnicol at perforce.com> wrote:
> >>
> >> Its not a particularly helpful observation but p4-php behaves the same
> way; I think its a fundamental part of p4.
> >>
> >> Its useful in its own way as you can use an output handler to deal with
> large files being printed 4k at a time.
> >>
> >> It is surprising though the first time you figure it out.
> >>
> >> -Geoff
> >>
> >> On Thu, Nov 6, 2014 at 1:46 PM, Jan Van Uytven <juytven at perforce.com
> <mailto:juytven at perforce.com>> wrote:
> >>
> >> I have a user who's a bit confused as to why the output of 'p4 print'
> >> (when run as p4.run_print("-q", "some_file")) returns an array with the
> >> contents of the file 'chunked' into 4096-byte segments.
> >>
> >> He points out that this isn't documented, and as far as I can tell, he's
> >> right.  Is there a particular reason why P4Python does this?
> >>
> >> (I'd check p4prod, but I can't seem to access it atm)
> >>
> >> - Jan
> >>
> >> --
> >> Jan Van Uytven
> >>
> >> Everything(Nothing) is true -
> >>    Everything is permissible!
> >>    - Hassan i Sabbah
> >> _______________________________________________
> >> p4python mailing list
> >> p4python at perforce.com <mailto:p4python at perforce.com>
> >> http://maillist.perforce.com/mailman/listinfo/p4python <
> http://maillist.perforce.com/mailman/listinfo/p4python>
> >>
> >> _______________________________________________
> >> p4python mailing list
> >> p4python at perforce.com
> >> http://maillist.perforce.com/mailman/listinfo/p4python
>
> --
> Jan Van Uytven
>
> It is certain any conviction gains infinitely
> the moment another soul will believe in it.
>    - Novalis
> _______________________________________________
> p4python mailing list
> p4python at perforce.com
> http://maillist.perforce.com/mailman/listinfo/p4python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.perforce.com/pipermail/p4python/attachments/20141109/0884d3f2/attachment-0002.html>


More information about the p4python mailing list