Return-Path: Delivered-To: apmail-incubator-cassandra-user-archive@minotaur.apache.org Received: (qmail 56262 invoked from network); 20 Jul 2009 02:21:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Jul 2009 02:21:30 -0000 Received: (qmail 46886 invoked by uid 500); 20 Jul 2009 02:22:35 -0000 Delivered-To: apmail-incubator-cassandra-user-archive@incubator.apache.org Received: (qmail 46872 invoked by uid 500); 20 Jul 2009 02:22:35 -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 46863 invoked by uid 99); 20 Jul 2009 02:22:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jul 2009 02:22:35 +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 gasol.wu@gmail.com designates 209.85.212.172 as permitted sender) Received: from [209.85.212.172] (HELO mail-vw0-f172.google.com) (209.85.212.172) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jul 2009 02:22:26 +0000 Received: by vwj2 with SMTP id 2so607472vwj.32 for ; Sun, 19 Jul 2009 19:22:05 -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=PDjCrEyWDXboD5C2TteSaYoNTWw3GUB1j6PzyWoXCRc=; b=HU6dgHND603FGCHhJ7Z3UbWYMXkzVJoJKITL4AssRbw4PpKbLbv8h6AlBn0fINzY2x BSnE3h0HGRvxGkA17ys2dZLOVOiXzRjrLn2qQCctGirzEQj68kCohrARlUoKB8PTDUbf H36zTYvkuJ5CKy/Cy3uJA52C1lAKjwYCzs5fM= 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=Z6ca9vMHAwzNrmINSqIoumAMM8GDobTXJ41SJlYn3FAlmDQfE0rRXKCn5Usz+CMuhc wZW4t+gjCxpzz9YXYTQuQOnQDd0X1t4u8ynisjhOZcpASUO5c8DP8wYwT5TUC8nLKk+a y/i3YEGghyBTzk26ADHj19D8tyg4yDU6PvvU0= MIME-Version: 1.0 Received: by 10.220.75.211 with SMTP id z19mr5182257vcj.43.1248056525257; Sun, 19 Jul 2009 19:22:05 -0700 (PDT) In-Reply-To: References: <70254fc70907191029i72cf77cav51cd6da1b5a18250@mail.gmail.com> Date: Mon, 20 Jul 2009 10:22:05 +0800 Message-ID: <70254fc70907191922r45219a52p4a1ba1c614b14a30@mail.gmail.com> Subject: Re: AttributeError: 'str' object has no attribute 'write' From: Gasol Wu To: cassandra-user@incubator.apache.org Content-Type: multipart/alternative; boundary=0016e6477a82d8fe40046f19cd6b X-Virus-Checked: Checked by ClamAV on apache.org --0016e6477a82d8fe40046f19cd6b Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 > > > > --0016e6477a82d8fe40046f19cd6b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Ian,

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

1.regenera= tion python client
cd $CASSANDRA_HOME/interface
thrift --gen py cassa= ndra.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);


On Mon, Jul 20, 2009 at 7:46 AM, Ian Hol= sman <ian@holsman.n= et> 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




--0016e6477a82d8fe40046f19cd6b--