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

Fix unicode formatting. #2339

Merged
merged 2 commits into from
Jan 30, 2018
Merged

Conversation

pkaleta
Copy link
Contributor

@pkaleta pkaleta commented Jan 25, 2018

On Python 2.x, scheduler.Task.pretty_id methods fails with the following error when a parameter's value contains a unicode code point:

Traceback (most recent call last):
  File "/Users/piotr/counsyl/luigi/test/scheduler_test.py", line 34, in test_pretty_id_unicode
    task.pretty_id
  File "/Users/piotr/counsyl/luigi/luigi/scheduler.py", line 338, in pretty_id
    param_str = ', '.join('{}={}'.format(key, value) for key, value in sorted(self.params.items()))
  File "/Users/piotr/counsyl/luigi/luigi/scheduler.py", line 338, in <genexpr>
    param_str = ', '.join('{}={}'.format(key, value) for key, value in sorted(self.params.items()))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2192' in position 0: ordinal not in range(128)

Description

Do not attempt to convert unicode to str, but return unicode object instead.

Have you tested this? If so, how?

I have included unit tests. I've also ran my jobs with this code and it works for me.

Copy link
Collaborator

@dlstadther dlstadther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pkaleta
Copy link
Contributor Author

pkaleta commented Jan 25, 2018

Thanks @dlstadther. Can one of the maintainers merge this? I don't have rights to do that.

@pkaleta
Copy link
Contributor Author

pkaleta commented Jan 30, 2018

friendly ping on this one

@dlstadther dlstadther merged commit 398eab8 into spotify:master Jan 30, 2018
@pkaleta
Copy link
Contributor Author

pkaleta commented Jan 30, 2018

Thanks @dlstadther!

@Tarrasch
Copy link
Contributor

Thanks @pkaleta!

This was referenced Jun 29, 2022
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.

3 participants