question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Testing if datetime is aware fails

See original GitHub issue
manager.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:closed
  • Created 8 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
maxim-khtcommented, Jun 7, 2018
0reactions
agronickcommented, Jan 17, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found