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

rq Job is not unicode friendly #437

Closed
difanz opened this issue Oct 16, 2014 · 3 comments
Closed

rq Job is not unicode friendly #437

difanz opened this issue Oct 16, 2014 · 3 comments

Comments

@difanz
Copy link

difanz commented Oct 16, 2014

The following code will immediately crash rq:

import json
queue.enqueue(json.dumps, '1', description='中文')

The traceback would be:

00:40:39 *** Listening on high, default, low...
Traceback (most recent call last):
  File "./scripts/rqworker.py", line 8, in <module>
    sys.exit(rq.scripts.rqworker.main())
  File "/Users/alex/Develop/django/lib/python2.7/site-packages/rq/scripts/rqworker.py", line 100, in main
    w.work(burst=args.burst)
  File "/Users/alex/Develop/django/lib/python2.7/site-packages/rq/worker.py", line 351, in work
    result = self.dequeue_job_and_maintain_ttl(timeout)
  File "/Users/alex/Develop/django/lib/python2.7/site-packages/rq/worker.py", line 389, in dequeue_job_and_maintain_ttl
    blue(job.description), job.id))
  File "/Users/alex/Develop/django/lib/python2.7/site-packages/rq/utils.py", line 134, in inner
    return colorizer.colorize(color, text)
  File "/Users/alex/Develop/django/lib/python2.7/site-packages/rq/utils.py", line 91, in colorize
    return self.codes[color_key] + text + self.codes["reset"]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)
selwin added a commit that referenced this issue Oct 20, 2014
@selwin
Copy link
Collaborator

selwin commented Oct 20, 2014

Fixed in #437 , @cheungtifan can you please verify that RQ no longer crashes in your use case?

@difanz
Copy link
Author

difanz commented Oct 21, 2014

LGTM on this CL. Thanks.

@selwin
Copy link
Collaborator

selwin commented Oct 21, 2014

Closing as fixed.

@selwin selwin closed this as completed Oct 21, 2014
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

No branches or pull requests

2 participants