circle-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[circle] A error in this simple code - help


From: Lucas Alberto
Subject: [circle] A error in this simple code - help
Date: Mon, 28 Jun 2004 21:24:03 -0300

Hi all!
I am new in the circle code, so I got the program posted some days ago
here by the malcolm handley, change some things ans executed.
But I got some erros, I don't know if this is a bug or some mistake in
my code.
Please help-me.

My code: nodetest.py
------------------
from __future__ import generators

import time
import circlelib.hash
import circlelib.node
import circlelib.proxy
import circlelib.utility

class MyTest:
        def __init__(self):
                self.node = circlelib.node.Node()
                print "node created"

        def start(self):
                # If you don't need a proxy, do this
                self.node.start()
                print "node started"
                # otherwise do this (proxy host is a string address@hidden)
                #   node.start(proxy_host)

                # Wait for it to connect
                connected = 0
                while not connected:
                        #print "."
                        circlelib.utility._daemon_action_timeout()
                        connected = 1
                        if not self.node.is_connected():
                                connected = 0
                        

                # < do some stuff with the node >
                
        def stop(self):
                # Finally
                self.node.stop()
                print "node stoped"

        def publishData(self, data_name, data_type, data_content):
                print "node publishing " + data_name + " " + data_type + " 
content: "
+ data_content
                data_key = circlelib.hash.hash_of(data_name)
                data_info = {"type": data_type , "time": time.time() , 
"content" :
data_content }
                self.node.publish(name=data_key, info=data_info)

        def getDataPublished(self, data_name):
                print "node retrieving already published data: " + data_name
                pipe = self.node.retrieve(circlelib.hash.hash_of(data_name))

                try:
                    while not pipe.finished():
                        address, data = pipe.read_all()
                    circlelib.utility._daemon_action_timeout()
                    time.sleep(1)
                finally:
                    pipe.stop()

                print "node get data " + data_name + " content: " + data + " 
from: " +
address
                return data


print "Testando o core The Circle"
teste = MyTest()
teste.start()
teste.publishData("chave.txt", "TXT", "Hello Circle!")

# wait some time to begin
for x in range(1000):
        time.sleep(0.01)
        circlelib.utility._daemon_action_timeout()

teste.getDataPublished("chave.txt")

teste.stop()
-------------------------------------------





And this is the Console ERROR:

--------------
Testando o core The Circle 
node created 
node started 
node publishing chave.txt TXT content: Hello Circle! 
node retrieving already published data: chave.txt 
Circle: data type error: expecting something dumpable, got something of
<type 'float'>: 1088396244.8800631. Traceback: 
File "nodetest.py", line 72, in ? 
teste.getDataPublished("chave.txt") 
File "nodetest.py", line 48, in getDataPublished 
pipe = self.node.retrieve(circlelib.hash.hash_of(data_name)) 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 2004, in
retrieve 
pipe.start(node_search,self,name,redundancy,addresses_only,local_only) 
File "/usr/lib/python2.3/site-packages/circlelib/utility.py", line 844,
in start 
apply(function,(self,)+parameters) 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 1249, in
node_search 
utility.start_thread(node_search_subsubthread( 
File "/usr/lib/python2.3/site-packages/circlelib/utility.py", line 197,
in start_thread 
type,params = thread.next() 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 1364, in
node_search_subsubthread 
ticket, template, wait = node.call( 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 2310, in
call 
reply = handle_request(self,query,address,ticket) 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 776, in
handle_request 
result = perform_request(node,request,address,call_id) 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 1084, in
perform_request 
ret = obj.handle(request, address, call_id) 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 1800, in
handle 
return perform_standard_request(self, request, address, call_id) 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 1016, in
perform_standard_request 
check.check_is_dumpable(result) address@hidden 
File "/usr/lib/python2.3/site-packages/circlelib/check.py", line 92, in
check_is_dumpable 
check_is_dumpable(item) 
File "/usr/lib/python2.3/site-packages/circlelib/check.py", line 97, in
check_is_dumpable 
check_is_dumpable(val) 
File "/usr/lib/python2.3/site-packages/circlelib/check.py", line 99, in
check_is_dumpable 
show_data_type_error('something dumpable', obj) 
Traceback (most recent call last): 
File "nodetest.py", line 72, in ? 
teste.getDataPublished("chave.txt") 
File "nodetest.py", line 48, in getDataPublished 
pipe = self.node.retrieve(circlelib.hash.hash_of(data_name)) 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 2004, in
retrieve 
pipe.start(node_search,self,name,redundancy,addresses_only,local_only) 
File "/usr/lib/python2.3/site-packages/circlelib/utility.py", line 844,
in start 
apply(function,(self,)+parameters) 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 1249, in
node_search 
utility.start_thread(node_search_subsubthread( 
File "/usr/lib/python2.3/site-packages/circlelib/utility.py", line 197,
in start_thread 
type,params = thread.next() 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 1364, in
node_search_subsubthread 
ticket, template, wait = node.call( 
File "/usr/lib/python2.3/site-packages/circlelib/node.py", line 2312, in
call 
raise reply 
circlelib.error.Error: <Error: bug encountered>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]