Tivix / django-cron

Write cron business logic as a Python class and let this app do the rest! It enables Django projects to schedule cron tasks, tracks their success / failures, manages contention (via a cache) etc. Basically takes care of all the boring work for you :-)
www.tivix.com
MIT License
900 stars 193 forks source link

Error in file locking backend with python 3 #74

Closed Maberi closed 6 years ago

Maberi commented 8 years ago

File ".../lib/python3.4/site-packages/django_cron/backends/lock/file.py", line 20, in lock f = open(lock_name, 'w+', 0) ValueError: can't have unbuffered text I/O

For python3, should change line 20 to f = open(lock_name, 'wb+', 0) and line 37 to f.write(bytearray(str(os.getpid()), 'utf-8'))

lindlof commented 8 years ago

I did the same except I changed the line 37 to: f.write(bytes(str(os.getpid()), 'UTF-8'))

Tested and works.

maxim-kht commented 6 years ago

Resolved in https://github.com/Tivix/django-cron/pull/110