Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed argument handling in rqinfo #127

Closed
wants to merge 1 commit into from
Closed

Conversation

obmarg
Copy link
Contributor

@obmarg obmarg commented Sep 2, 2012

rqinfo was using None for the redis host and port, which was causing
exceptions when trying to connect. It was possible to supply these on
the commandline, but port was just being passed straight through as a
string, which also caused exceptions.

This commit moves some of the argument & configuration file handling out
of rqworker and into the scripts/init.py file, and then calls it
from rqinfo.

rqinfo was using None for the redis host and port, which was causing
exceptions when trying to connect.  It was possible to supply these on
the commandline, but port was just being passed straight through as a
string, which also caused exceptions.

This commit moves some of the argument & configuration file handling out
of rqworker and into the scripts/__init__.py file, and then calls it
from rqinfo.
@travisbot
Copy link

This pull request passes (merged 365d1d8 into db82d5c).

@saulshanabrook
Copy link

For anyone who is looking this fixes an TypeError: coercing to Unicode: need string or buffer, NoneType found when running rqinfo

Full traceback on clean virtualenv with just rq installed:

Traceback (most recent call last):
  File "/Users/saul/.virtualenvs/django-canadanewyork/bin/rqinfo", line 8, in <module>
    load_entry_point('rq==0.3.1', 'console_scripts', 'rqinfo')()
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/rq/scripts/rqinfo.py", line 174, in main
    interval(args.interval, func, args)
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/rq/scripts/rqinfo.py", line 152, in interval
    func(args)
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/rq/scripts/rqinfo.py", line 125, in show_both
    show_queues(args)
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/rq/scripts/rqinfo.py", line 45, in show_queues
    qs = Queue.all()
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/rq/queue.py", line 30, in all
    return map(to_queue, connection.keys('%s*' % prefix))
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/redis/client.py", line 522, in keys
    return self.execute_command('KEYS', pattern)
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/redis/client.py", line 334, in execute_command
    connection.send_command(*args)
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/redis/connection.py", line 287, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/redis/connection.py", line 269, in send_packed_command
    self.connect()
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/redis/connection.py", line 214, in connect
    sock = self._connect()
  File "/Users/saul/.virtualenvs/django-canadanewyork/lib/python2.7/site-packages/redis/connection.py", line 226, in _connect
    sock.connect((self.host, self.port))
  File "/usr/local/Cellar/python/2.7.3/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
TypeError: coercing to Unicode: need string or buffer, NoneType found

@nvie
Copy link
Collaborator

nvie commented Sep 3, 2012

Great patch, completely missed this one. Thanks.

@nvie nvie closed this in 59d150f Sep 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants