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

Unicode strings upset the timestamp context manager #74

Open
ianozsvald opened this issue Feb 9, 2014 · 1 comment
Open

Unicode strings upset the timestamp context manager #74

ianozsvald opened this issue Feb 9, 2014 · 1 comment

Comments

@ianozsvald
Copy link
Contributor

Using a unicode string inside a timestamp context manager:
with profile.timestamp(u"Adding_jobs"):
causes:
TypeError: __name__ must be set to a string object

This can be caused with a normal looking Python string if you use from __future__ import unicode_literals (as I originally did) and the error message isn't as informative as it could be. The solution, if using the __future__ import is to force a binary sequence:
with profile.timestamp(b"Adding_jobs"):

I mention this more just to help others spot the problem if they hit this error message.

@fabianp
Copy link
Collaborator

fabianp commented Feb 9, 2014

Thanks @ianozsvald ! Do you think it would be possible to allow unicode strings inside a timestamp context manager ? (if not, maybe a check in the TimeStamper.timestamp would be nice)

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