[p4] Python mMarshalling problem

Smith, Jeff jsmith at medplus.com
Tue Oct 5 09:24:35 PDT 2004


I'm confused here.  What makes you think they are tuples?  When I print
out type(slines) I get <type 'list'>

Jeff

-----Original Message-----
From: Chuck Karish [mailto:chuck.karish at gmail.com] 
Sent: Tuesday, October 05, 2004 10:35 AM
To: Smith, Jeff
Cc: perforce-user at perforce.com
Subject: Re: [p4] Python mMarshalling problem


Why are slines and mlines tuples rather than lists?

On Tue, 5 Oct 2004 09:59:19 -0400, Smith, Jeff <jsmith at medplus.com>
wrote:
> The attached python test script produces interesting results.
> 
> When run on our UNIX systems of different flavors, it reports
>         string lines = 1004
>         marshaled lines = 1004
> 
> On our Windows platforms, we get
>         string lines = 1004
>         marshaled lines = 188
> 
> This has been run against Python 2.3.3 and 2.3.4 as well as Perforce 
> 2002.2 and 2004.2
> 
> Any input is appreciated,
> Jeff Smith
> 
> import os
> import marshal
> 
> slines = list()
> for line in os.popen('p4 labels'):
>     slines.append(line)
> 
> mstream = os.popen('p4 -G labels')
> mlines = list()
> while 1:
>     try:
>         item = marshal.load(mstream)
>         mlines.append(item)
>     except EOFError:
>         break
> 
> print 'string lines = ' + str(len(slines))
> print 'marshaled lines = ' + str(len(mlines))



-- 
Chuck Karish   karish at well.com   (415) 317-0182




More information about the perforce-user mailing list