[ZODB-Dev] how can I get the size of ZODB.Blob object ?

2009-07-07 Thread KLEIN Stéphane
Hi, I've take cognizance of ZODB.Blob. I think it's great tools. Know, I've one question : how can I get the size (in octet) of Blob object ? >>> f = myblob.open("r") >>> size = len(f.read()) >>> print size This code isn't efficient. What is the good method ? Thanks for your help, Stephane _

Re: [ZODB-Dev] how can I get the size of ZODB.Blob object ?

2009-07-07 Thread Andreas Jung
How about seek()ing to the end of the blob and then using tell() for getting the position? Andreas On 07.07.09 15:11, KLEIN Stéphane wrote: > Hi, > > I've take cognizance of ZODB.Blob. I think it's great tools. > > Know, I've one question : how can I get the size (in octet) of Blob > object ? >

Re: [ZODB-Dev] how can I get the size of ZODB.Blob object ?

2009-07-07 Thread Christian Theune
On 07/07/2009 04:47 PM, Andreas Jung wrote: > How about seek()ing to the end of the blob and then using tell() for getting > the position? > Yup. An opened blob is just a regular file handle. So the same applies as to normal files: >>> f = open('asdf') >>> t.seek(0, 2) >>> t.tell() 35L C

Re: [ZODB-Dev] how can I get the size of ZODB.Blob object ?

2009-07-07 Thread Klein Stéphane
Le Tue, 07 Jul 2009 16:54:07 +0200, Christian Theune a écrit : > On 07/07/2009 04:47 PM, Andreas Jung wrote: >> How about seek()ing to the end of the blob and then using tell() for >> getting the position? >> > Yup. > > An opened blob is just a regular file handle. So the same applies as to >