AttributeError: 'str' object has no attribute 'write'

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

AttributeError: 'str' object has no attribute 'write'

mobiledreamers
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/<ipython console> in <module>()

/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
Reply | Threaded
Open this post in threaded view
|

Re: AttributeError: 'str' object has no attribute 'write'

Gasol Wu
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, <[hidden email]> 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/<ipython console> in <module>()

/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

Reply | Threaded
Open this post in threaded view
|

Re: AttributeError: 'str' object has no attribute 'write'

Ian Holsman-3
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, <[hidden email]> 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/<ipython console> in <module>()
>
> /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
[hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: AttributeError: 'str' object has no attribute 'write'

Jonathan Ellis-3
Building the java interface is part of the build, but ant has no way
to guess which additional client interfaces you want to use, if any.

On Sun, Jul 19, 2009 at 6:46 PM, Ian Holsman<[hidden email]> 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, <[hidden email]> 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/<ipython console> in <module>()
>>
>> /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
> [hidden email]
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: AttributeError: 'str' object has no attribute 'write'

Gasol Wu
In reply to this post by Ian Holsman-3
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 <[hidden email]> 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, <[hidden email]> 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/<ipython console> in <module>()

/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
[hidden email]




Reply | Threaded
Open this post in threaded view
|

Re: AttributeError: 'str' object has no attribute 'write'

Eric Evans-4
In reply to this post by Ian Holsman-3
On Mon, 2009-07-20 at 09:46 +1000, Ian Holsman wrote:
> shouldn't regeneration of the interface be part of the build process?

As a convenience, there is an ant target called "gen-thrift-py", but
it's left to users to run since we are not checking generated python
into subversion.

--
Eric Evans
[hidden email]

Reply | Threaded
Open this post in threaded view
|

a talk on building an email app on Cassandra

Jun Rao

Last Friday, I gave an IEEE talk on an email app that we built on top of Cassandra. Below is the link to the slides. I thought some of the people here might find this interesting.

http://ewh.ieee.org/r6/scv/computer//nfic/2009/IBM-Jun-Rao.pdf

Jun
IBM Almaden Research Center
K55/B1, 650 Harry Road, San Jose, CA 95120-6099

[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: a talk on building an email app on Cassandra

Michael Greene
That looks really great, thanks for sharing with us.  Can you add that
to http://wiki.apache.org/cassandra/ArticlesAndPresentations ?

Michael

On Mon, Jul 20, 2009 at 12:43 PM, Jun Rao<[hidden email]> wrote:

> Last Friday, I gave an IEEE talk on an email app that we built on top of
> Cassandra. Below is the link to the slides. I thought some of the people
> here might find this interesting.
>
> http://ewh.ieee.org/r6/scv/computer//nfic/2009/IBM-Jun-Rao.pdf
>
> Jun
> IBM Almaden Research Center
> K55/B1, 650 Harry Road, San Jose, CA 95120-6099
>
> [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: a talk on building an email app on Cassandra

Jonathan Ellis-3
In reply to this post by Jun Rao
Nice!

On Mon, Jul 20, 2009 at 12:43 PM, Jun Rao<[hidden email]> wrote:

> Last Friday, I gave an IEEE talk on an email app that we built on top of
> Cassandra. Below is the link to the slides. I thought some of the people
> here might find this interesting.
>
> http://ewh.ieee.org/r6/scv/computer//nfic/2009/IBM-Jun-Rao.pdf
>
> Jun
> IBM Almaden Research Center
> K55/B1, 650 Harry Road, San Jose, CA 95120-6099
>
> [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: a talk on building an email app on Cassandra

Evan Weaver
Woah, nice!

One year development on the Cassandra backend? That's intense. What
build are you running? Is this fully productionized and being used at
IBM?

Evan

On Mon, Jul 20, 2009 at 11:07 AM, Jonathan Ellis<[hidden email]> wrote:

> Nice!
>
> On Mon, Jul 20, 2009 at 12:43 PM, Jun Rao<[hidden email]> wrote:
>> Last Friday, I gave an IEEE talk on an email app that we built on top of
>> Cassandra. Below is the link to the slides. I thought some of the people
>> here might find this interesting.
>>
>> http://ewh.ieee.org/r6/scv/computer//nfic/2009/IBM-Jun-Rao.pdf
>>
>> Jun
>> IBM Almaden Research Center
>> K55/B1, 650 Harry Road, San Jose, CA 95120-6099
>>
>> [hidden email]
>>
>



--
Evan Weaver
Reply | Threaded
Open this post in threaded view
|

Re: a talk on building an email app on Cassandra

Neophytos Demetriou
In reply to this post by Jun Rao
Jun Rao wrote:
> I thought some of the people
> here might find this interesting.

I did. Thank you very much Jun.

- Neophytos
Reply | Threaded
Open this post in threaded view
|

Re: a talk on building an email app on Cassandra

Jun Rao
In reply to this post by Evan Weaver

This is on a trunk version of cassandra in June. Currently, this is just a prototype. We don't have any real users running on the cassandra-based backend yet.

Jun
IBM Almaden Research Center
K55/B1, 650 Harry Road, San Jose, CA 95120-6099

[hidden email]


Evan Weaver <[hidden email]> wrote on 07/20/2009 11:58:37 AM:

>
> Woah, nice!
>
> One year development on the Cassandra backend? That's intense. What
> build are you running? Is this fully productionized and being used at
> IBM?
>
> Evan
>
> On Mon, Jul 20, 2009 at 11:07 AM, Jonathan Ellis<[hidden email]> wrote:
> > Nice!
> >
> > On Mon, Jul 20, 2009 at 12:43 PM, Jun Rao<[hidden email]> wrote:
> >> Last Friday, I gave an IEEE talk on an email app that we built on top of
> >> Cassandra. Below is the link to the slides. I thought some of the people
> >> here might find this interesting.
> >>
> >> http://ewh.ieee.org/r6/scv/computer//nfic/2009/IBM-Jun-Rao.pdf
> >>
> >> Jun
> >> IBM Almaden Research Center
> >> K55/B1, 650 Harry Road, San Jose, CA 95120-6099
> >>
> >> [hidden email]
> >>
> >
>
>
>
> --
> Evan Weaver

Reply | Threaded
Open this post in threaded view
|

Re: AttributeError: 'str' object has no attribute 'write'

mobiledreamers
In reply to this post by Gasol Wu
Thanks Gasol wu
this helped

On Sun, Jul 19, 2009 at 7:22 PM, Gasol Wu <[hidden email]> 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 <[hidden email]> 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, <[hidden email]> 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/<ipython console> in <module>()

/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
[hidden email]







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