Testing if datetime is aware fails
See original GitHub issuemanager.run(force)
File "/var/www/hosts/bettersubbox.com/dev/local/lib/python2.7/site-packages/django_cron/__init__.py", line 209, in run
with self.lock_class(cron_job_class, self.silent):
File "/var/www/hosts/bettersubbox.com/dev/local/lib/python2.7/site-packages/django_cron/backends/lock/base.py", line 60, in __enter__
raise self.LockFailedException(self.lock_failed_message())
File "/var/www/hosts/bettersubbox.com/dev/local/lib/python2.7/site-packages/django_cron/backends/lock/cache.py", line 47, in lock_failed_message
started = self.get_running_lock_date()
File "/var/www/hosts/bettersubbox.com/dev/local/lib/python2.7/site-packages/django_cron/backends/lock/cache.py", line 90, in get_running_lock_date
if not timezone.is_aware(date):
File "/var/www/hosts/bettersubbox.com/dev/local/lib/python2.7/site-packages/django/utils/timezone.py", line 340, in is_aware
return value.utcoffset() is not None
AttributeError: 'NoneType' object has no attribute 'utcoffset'
``
Django 1.9, failed once out of thousands of runs...
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
How to check if a datetime object is localized with pytz?
A time object t is aware if t.tzinfo is not None and t.tzinfo.utcoffset(None) does not return None. Otherwise, t is naive." – Gonzalo....
Read more >How to make a timezone aware datetime object in Python
We can easily check if a datetime object is timezone-aware or not. For this, we will store the current date and time in...
Read more >Work with dates and times in Python using datetime
If your datetime object knows what timezone the date and time it represents is in, then we call that an aware datetime object....
Read more >Working with Datetime Objects and Timezones in Python
A naive datetime object contains no timezone information. The easiest way to tell if a datetime object is naive is by checking tzinfo....
Read more >How to work with dates and time with Python | Bloomberg LP
The result of gettz gives us an object that we can use to create time-zone-aware dates in Python: >>> import datetime as dt ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Resolved in https://github.com/Tivix/django-cron/pull/130
Just one but they run all the time. I think the problem is that maybe 1 out of every 500 jobs finishes between the time when that cache key is checked and when it is read the second time.