Return-Path: Delivered-To: apmail-incubator-cassandra-user-archive@minotaur.apache.org Received: (qmail 3507 invoked from network); 21 Jul 2009 16:16:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Jul 2009 16:16:10 -0000 Received: (qmail 80911 invoked by uid 500); 21 Jul 2009 16:17:15 -0000 Delivered-To: apmail-incubator-cassandra-user-archive@incubator.apache.org Received: (qmail 80886 invoked by uid 500); 21 Jul 2009 16:17:15 -0000 Mailing-List: contact cassandra-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cassandra-user@incubator.apache.org Delivered-To: mailing list cassandra-user@incubator.apache.org Received: (qmail 80877 invoked by uid 99); 21 Jul 2009 16:17:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jul 2009 16:17:15 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mobiledreamers@gmail.com designates 209.85.210.191 as permitted sender) Received: from [209.85.210.191] (HELO mail-yx0-f191.google.com) (209.85.210.191) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jul 2009 16:17:06 +0000 Received: by yxe29 with SMTP id 29so4838995yxe.32 for ; Tue, 21 Jul 2009 09:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=zyJrugMx0ed74djc+h0NN58OoKgsk+ilWiS1v1TBU58=; b=yFvv3ukayEslBQL2nDQCiPkJr+2DMX0n/kw5ego+Y///ESb6j356QoDfYr5RfB7xKo Wep32SYIbEQZV4QMTmlX7+3/+dxPf0tvxiZld3tsJlI05R6fV3pOLh6GUYaS9LK5C/OY ARefrL4lLZhS81A8wshAVvkw6oRnJvM4ndX/8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ge0aIANx2wOTRRX6uo46cK61y1MtiXGWHI+Qs5X7R34j6DE+D9NxtgR07rDQagMwK5 PQHMd9Xuvx9YJsXyNpApunpjAeFOT7PD9kXmkHZYKsIXq7Z2E0HkeUYTkOPJ3bqQysTt s7nLt7U2h6kkP9EwuDKVL/oTW3k2AoKmnJ2fk= MIME-Version: 1.0 Received: by 10.100.34.10 with SMTP id h10mr8020571anh.182.1248193005731; Tue, 21 Jul 2009 09:16:45 -0700 (PDT) In-Reply-To: <70254fc70907191922r45219a52p4a1ba1c614b14a30@mail.gmail.com> References: <70254fc70907191029i72cf77cav51cd6da1b5a18250@mail.gmail.com> <70254fc70907191922r45219a52p4a1ba1c614b14a30@mail.gmail.com> Date: Tue, 21 Jul 2009 09:16:45 -0700 Message-ID: Subject: Re: AttributeError: 'str' object has no attribute 'write' From: mobiledreamers@gmail.com To: cassandra-user@incubator.apache.org Content-Type: multipart/alternative; boundary=001485f33b3eb7c1c0046f399480 X-Virus-Checked: Checked by ClamAV on apache.org --001485f33b3eb7c1c0046f399480 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thanks Gasol wuthis helped On Sun, Jul 19, 2009 at 7:22 PM, Gasol Wu wrote: > Hi Ian, > > http://issues.apache.org/jira/browse/CASSANDRA-139 > > 1.regeneration python client > cd $CASSANDRA_HOME/interface > thrift --gen py cassandra.thrift > 2.recompile cassandra > cd $CASSANDRA_HOME > ant > 3.modify your code. > > below is my php code that i changed. > old: > $client->insert($table, $i, 'Standard1:md5', md5($i), $time, $block); > > new trunk: > $cp_md5 = new cassandra_ColumnPath(array('column_family' => 'Standard1', > 'column' => 'md5')); > $client->insert($table, $i, $cp_md5, md5($i), $time, $block); > > > > On Mon, Jul 20, 2009 at 7:46 AM, Ian Holsman wrote: > >> hi Gasol. >> shouldn't regeneration of the interface be part of the build process? >> >> >> On 20/07/2009, at 3:29 AM, Gasol Wu wrote: >> >> hi, >>> the cassandra.thrift has changed. >>> u need to generate new python client and compile class again. >>> >>> >>> On Mon, Jul 20, 2009 at 1:18 AM, wrote: >>> Hi guys >>> the new trunk cassandra doesnt work for a simple insert, how do we get >>> this working >>> >>> client.insert('Table1', 'tofu', 'Super1:Related:tofu >>> stew',pickle.dumps(dict(count=1)), time.time(), 0) >>> >>> --------------------------------------------------------------------------- >>> AttributeError Traceback (most recent call >>> last) >>> >>> /home/mark/work/cexperiments/ in () >>> >>> /home/mark/work/common/cassandra/Cassandra.py in insert(self, table, key, >>> column_path, value, timestamp, block_for) >>> 358 - block_for >>> 359 """ >>> --> 360 self.send_insert(table, key, column_path, value, timestamp, >>> block_for) >>> 361 self.recv_insert() >>> 362 >>> >>> /home/mark/work/common/cassandra/Cassandra.py in send_insert(self, table, >>> key, column_path, value, timestamp, block_for) >>> 370 args.timestamp = timestamp >>> 371 args.block_for = block_for >>> --> 372 args.write(self._oprot) >>> 373 self._oprot.writeMessageEnd() >>> 374 self._oprot.trans.flush() >>> >>> /home/mark/work/common/cassandra/Cassandra.py in write(self, oprot) >>> 1923 if self.column_path != None: >>> 1924 oprot.writeFieldBegin('column_path', TType.STRUCT, 3) >>> -> 1925 self.column_path.write(oprot) >>> 1926 oprot.writeFieldEnd() >>> 1927 if self.value != None: >>> >>> AttributeError: 'str' object has no attribute 'write' >>> In [4]: client.insert('Table1', 'tofu', 'Super1:Related:tofu >>> stew',pickle.dumps(dict(count=1)), time.time(), 0) >>> >>> >>> -- >>> Bidegg worlds best auction site >>> http://bidegg.com >>> >>> >> -- >> Ian Holsman >> Ian@Holsman.net >> >> >> >> > -- Bidegg worlds best auction site http://bidegg.com --001485f33b3eb7c1c0046f399480 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks Gasol wu
this helped

On Sun, J= ul 19, 2009 at 7:22 PM, Gasol Wu <gasol.wu@gmail.com> wrote:
Hi Ian,

http://issues.apache.org/jira/browse/CASSANDRA-139=

1.regeneration python client
cd $CASSANDRA_HOME/interface
thr= ift --gen py cassandra.thrift
2.recompile cassandra
cd $CASSANDRA_HOME
ant
3.modify your code.<= br>
below is my php code that i changed.
old:
$client->insert($table, $i, 'Standard1:md5', md5($i), $time, $bl= ock);

new trunk:
$cp_md5 =3D new cassandra_ColumnPath(array('column_family' =3D> = 'Standard1', 'column' =3D> 'md5'));
$client->insert($table, $i, $cp_md5, md5($i), $time, $block);
<= /div>



On Mon, Jul 20, 2009 at 7:46 AM, Ian Hol= sman <ian@holsman.net> wrote:
hi Gasol.
shouldn't regeneration of the interface be part of the build process?


On 20/07/2009, at 3:29 AM, Gasol Wu wrote:

hi,
the cassandra.thrift has changed.
u need to generate new python client and compile class again.


On Mon, Jul 20, 2009 at 1:18 AM, <mobiledreamers@gmail.com> wrote:
Hi guys
the new trunk cassandra doesnt work for a simple insert, how do we get this= working

client.insert('Table1', 'tofu', 'Super1:Related:tofu st= ew',pickle.dumps(dict(count=3D1)), time.time(), 0)
---------------------------------------------------------------------------=
AttributeError =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Trace= back (most recent call last)

/home/mark/work/cexperiments/<ipython console> in <module>()
/home/mark/work/common/cassandra/Cassandra.py in insert(self, table, key, c= olumn_path, value, timestamp, block_for)
=A0 =A0358 =A0 =A0 =A0- block_for
=A0 =A0359 =A0 =A0 """
--> 360 =A0 =A0 self.send_insert(table, key, column_path, value, timesta= mp, block_for)
=A0 =A0361 =A0 =A0 self.recv_insert()
=A0 =A0362

/home/mark/work/common/cassandra/Cassandra.py in send_insert(self, table, k= ey, column_path, value, timestamp, block_for)
=A0 =A0370 =A0 =A0 args.timestamp =3D timestamp
=A0 =A0371 =A0 =A0 args.block_for =3D block_for
--> 372 =A0 =A0 args.write(self._oprot)
=A0 =A0373 =A0 =A0 self._oprot.writeMessageEnd()
=A0 =A0374 =A0 =A0 self._oprot.trans.flush()

/home/mark/work/common/cassandra/Cassandra.py in write(self, oprot)
=A0 1923 =A0 =A0 if self.column_path !=3D None:
=A0 1924 =A0 =A0 =A0 oprot.writeFieldBegin('column_path', TType.ST= RUCT, 3)
-> 1925 =A0 =A0 =A0 self.column_path.write(oprot)
=A0 1926 =A0 =A0 =A0 oprot.writeFieldEnd()
=A0 1927 =A0 =A0 if self.value !=3D None:

AttributeError: 'str' object has no attribute 'write'
In [4]: client.insert('Table1', 'tofu', 'Super1:Related= :tofu stew',pickle.dumps(dict(count=3D1)), time.time(), 0)


--
Bidegg worlds best auction site
http://bidegg.com


--
Ian Holsman
Ian@Holsman.net







--
Bidegg worl= ds best auction site
http://bidegg.com=
--001485f33b3eb7c1c0046f399480--