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

Described API (&tests) broken on python3 #8

Open
mgorny opened this issue May 17, 2017 · 2 comments
Open

Described API (&tests) broken on python3 #8

mgorny opened this issue May 17, 2017 · 2 comments

Comments

@mgorny
Copy link

mgorny commented May 17, 2017

When using python3, the documented API does not work:

In [1]: import timelib

In [2]: timelib.strtotime('12:55')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-ac895873636a> in <module>()
----> 1 timelib.strtotime('12:55')

timelib.pyx in timelib.strtotime (timelib.c:1215)()

TypeError: expected bytes, str found

The issue can be worked around by using byte input but I don't think that's the intended (or friendly) way of doing it:

In [3]: timelib.strtotime(b'12:55')
Out[3]: 1495025700

Plus, this breaks the tests.

@guysoft
Copy link

guysoft commented Dec 26, 2017

Same here.
Does anyone know how to fix this?

@guysoft
Copy link

guysoft commented Dec 28, 2017

Another workaround is to do timelib.strtotime('12:55'.encode('utf-8'))

so:

if sys.version_info >= (3,0):
    timelib.strtotime('12:55'.encode('utf-8'))
else:
    timelib.strtotime('12:55')

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