-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
AttributeError: 'tzlocal' object has no attribute 'localize' #32
Comments
Update: This occurs when the input object to the
results in
is fine. |
Okay, you are using |
👍 . I solved it on my side by removing the timezone info from the datetime object, i.e. |
That definitely works for UTC, though will go weird for non-UTC timezones. Did you need different timezone support? I should fix it anyway, apparently I was using a pytz-internal interface, not one necessarily shared by the default Python timezone interface (the default interface is what was broken before). |
I am using UTC, no special requirement for other timezones from my side but it does seem like the latest master merge you did brought whatever timezone the input had to UTC. I think that's a perfectly good way to go about it but the problem is more of the exception I don't use pytz in my project but I would assume it would be a dependency of yours and so I'm really surprised that I would get the exception if |
No, we don't automatically install pytz, but we do test against it, and the only timezone tests are against pytz. I had been reading some docs on what should be available in tzinfo, which is why I was using localize, but I forgot to keep a link, and I'm not finding it right now. I'm duplicating the tests and am going to run it through again. On the pytz side of things raising exceptions; we don't normally add timezone information purposefully, and our use of localize in those cases seems to be fine (at least in the DST cutover in spring / fall in what I've tested). I have used pytz with I'll get a version out that works with not pytz, and is tested specifically with dateutil (and maybe Python's built in local timezone), so most folks should be covered going forward. |
Okay, just released 0.22.4, which should fix dateutil users. Didn't need to do anything for folks using Thank you for the bug report, let me know if this works or breaks for you. |
The recent release (0.22.3) causes a new issue.
The message
AttributeError: 'tzlocal' object has no attribute 'localize'
occurs when calling thenext()
method with adefault_utc=True
and anow=datetime
arguments.The input datetime (to the
now
argument) isdatetime.utcnow()
.This is exactly in the lines changed in the 0.22.3 release and was not an issue in 0.22.2.
The text was updated successfully, but these errors were encountered: