-
Notifications
You must be signed in to change notification settings - Fork 128
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
utils.strptime
and utils.strftime
are asymmetrical
#81
Comments
Ah ok, I was not aware about 3.7 support. So this is what I am facing >>> from datetime import datetime
>>> from singer import utils
>>> import pytz
>>> utc = pytz.UTC
>>> now = datetime.utcnow().replace(tzinfo=utc)
>>> dtime = utils.strftime(now)
>>> utils.strptime(dtime)
ValueError: time data '2018-10-19T20:53:38.514627Z' does not match format '%Y-%m-%dT%H:%M:%SZ' In short I can not get the datetime back with formatted string. The problem is because of Line 27 in f6c5227
|
Also locally I am running python 3.7 but this error is coming on stitchdata running on python 3.5. Let me know, happy to send a fix. |
I need to know some more details about the error your seeing.
I'm going to do a bit of digging myself but at the moment I suspect that the underlying C library is actually what's throwing this error. |
So it appears that you've uncovered an asymmetry between That said, it appears if you use
We (or you via a PR) may take the step to deprecate |
utils.strptime
and utils.strftime
are asymmetrical
Motivation ---------- This appears to have been deprecated for some time and is poorly behaved in the case of fractional seconds. `utils.strptime_to_utc` is preferred anyway. See singer-io#81 Implementation Notes -------------------- - Move to circle 2.0 - Add doctest to the nose runner - Add a docstring and warn call to utils.strptime
@timvisher thank you for the explanation, I will send a PR as soon I get time. |
#82 closes this issue. |
EDIT: Current summary of this issue is here.
I am using python 3.7 and it looks like
singer-python/singer/utils.py
Line 14 in f6c5227
The text was updated successfully, but these errors were encountered: