Strange behavior, can someone explain?

2 views
Skip to first unread message

mailp...@email.com

unread,
May 2, 2008, 2:01:52 AM5/2/08
to Orbited Discussion
I am doing the tutorial at http://brbx.com/orbited/tutorials/python_intro.html

When I run the python commands to issue an event, I get the following
error:
/sw/lib/python2.5/site-packages/pyorbited-0.1.1-py2.5.egg/pyorbited/
simple.py:59: DeprecationWarning: raising a string exception is
deprecated
raise "ConnectionLost"
Traceback (most recent call last):
File "test.py", line 5, in <module>
client.event([user_key], headers, False)
File "build/bdist.macosx-10.4-i386/egg/pyorbited/simple.py", line
62, in event
File "build/bdist.macosx-10.4-i386/egg/pyorbited/simple.py", line
32, in reconnect
File "build/bdist.macosx-10.4-i386/egg/pyorbited/simple.py", line
28, in disconnect
AttributeError: 'NoneType' object has no attribute 'close'

It appears that the socket is unexpectedly 'None', so I decided to
place a print statement in the connect method of the Client class like
so:
def
connect(self):
...
self.socket = io.client_socket(self.addr,
self.port)

self.socket.setblocking(1)
print self.socket

Running the example again, it worked, printing out a representation of
the socket object and sending data to the browser!

What is causing this error, and how is a single print statement fixing
it? I think it has something to do with blocking but I don't
understand what's going on. Thanks!

mailp...@email.com

unread,
May 2, 2008, 12:55:18 PM5/2/08
to Orbited Discussion
I've distilled my problem to something more simple:

It seems that doing sock.setblocking(0) before sock.connect_ex((addr,
port)) causes the socket to fail to connect most of the time. What is
the advantage of having a non-blocking connect, and why is this
causing an error for me but not others?

On May 1, 11:01 pm, "pennyco...@gmail.com" <mailpitc...@email.com>
wrote:
> I am doing the tutorial athttp://brbx.com/orbited/tutorials/python_intro.html

mailp...@email.com

unread,
May 2, 2008, 2:07:47 PM5/2/08
to Orbited Discussion
Update: I was informed that setblocking(0) prior to connect is a bug,
and will be taken out in the next version of orbited.

On May 2, 9:55 am, "pennyco...@gmail.com" <mailpitc...@email.com>
wrote:
Reply all
Reply to author
Forward
0 new messages