Skip to content
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.

Exception while using publish/subscribe #7

Open
kaikuehne opened this issue Jul 20, 2011 · 1 comment
Open

Exception while using publish/subscribe #7

kaikuehne opened this issue Jul 20, 2011 · 1 comment

Comments

@kaikuehne
Copy link

Hi.
I'm getting an exception using thoonk with publish/subscribe. I'm using FreeBSD, Python 2.6.7 and redis 2.2.11.

What am I doing wrong? Thanks!

$ pip freeze | grep redis
hiredis==0.1.0
redis==2.2.4
$ pip freeze | grep thoonk
-e git+https://github.com/andyet/thoonk.py.git@2ba5592da65357313ecddbbf041b28183c95c0c0#egg=thoonk-dev
$ python
>>> import redis
>>> r = redis.Redis(db=10)
>>> r.flushdb()
>>> ^D
$ cat test_thoonk.py
#!/usr/bin/env python

import thoonk


def publish_handler(feedname, item, id):
    print 'test'


def main():
    foo = thoonk.Thoonk(db=10, listen=True)
    foo.register_handler('publish_notice', publish_handler)
    feed = foo.feed('test')
    feed.publish('1')
    feed.publish('23')
    feed.publish('42')


if __name__ == '__main__':
    main()
$ python test_thoonk.py
test
test
Exception in thread Thread-1 (most likely raised during interpreter shutdown):$
@kaikuehne
Copy link
Author

The example also doesn't work on OSX Lion, but no exception is thrown. I used (the shipped) Python 2.7.1 and the same python packages from pypi.
This is the output (printing the id this time):

$ python test_thoonk.py 
9fe6ae19437046cd8aaea74fd52024c3
d792d54c11274314ae2ccadd3e91f2e4
8d1659e7c2ed4cc39e67fedd9402133b
$ python test_thoonk.py 
78c2ac18008c49d0ba0c42b49963f630
e5ae43493713446999d1b561f94de20b
ef7dedb27c44414ba925a395009cfdb8

$ python test_thoonk.py 
e137224bd55741328c4712577b946916
211f2061a13a4a9d96d6e34d1ca63688

So, it's returning three items most of the time, but sometimes only two. And adds a newline randomly.

What can I do to supply you with more useful information?

Update: After a few iterations, It's throwing the same exception. This time with a message:

$ python test_thoonk.py 
e164b4f2a54c40338987fc42124794d9
2ec93b47b93d4424a2492f8564e13bd2
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 530, in __bootstrap_inner
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 483, in run
  File "/Users/kai/.virtualenvs/bla/src/thoonk/thoonk/pubsub.py", line 331, in listen
  File "/Users/kai/.virtualenvs/bla/lib/python2.7/site-packages/redis/client.py", line 1219, in listen
  File "/Users/kai/.virtualenvs/bla/lib/python2.7/site-packages/redis/client.py", line 259, in parse_response
  File "/Users/kai/.virtualenvs/bla/lib/python2.7/site-packages/redis/connection.py", line 161, in read_response
<type 'exceptions.TypeError'>: 'NoneType' object is not callable

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant