TypeError: '<=' not supported between instances of 'str' and 'int'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Concurrent Log Handler for Python |
New
|
Undecided
|
Unassigned |
Bug Description
Using concurrentLogHa
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib64/
self.
File "/home/
if self.backupCount <= 0:
TypeError: '<=' not supported between instances of 'str' and 'int'
Call stack:
File "manage.py", line 25, in <module>
execute_
File "/home/
utility.
File "/home/
self.
File "/home/
self.
File "/home/
output = self.handle(*args, **options)
File "/home/
return getattr(self, shell)(options)
File "/home/
code.
File "/usr/lib64/
console.
File "/usr/lib64/
more = self.push(line)
File "/usr/lib64/
more = self.runsource(
File "/usr/lib64/
self.
File "/usr/lib64/
exec(code, self.locals)
File "<console>", line 1, in <module>
File "/home/
data = list(self[
File "/home/
self.
File "/home/
self.
File "/home/
results = compiler.
File "/home/
cursor.
File "/home/
extra=
Message: '(%.3f) %s; args=%s'
Debugging the project I've found the problem is in doRollover method (cloghandler.py) at the statement:
if self.backupCount <= 0:
I think the solution could be:
if int(self.
This exception raised because I've setted up the logger configuration 'backupCount' parameter as string: ('backupCount': '30',)
This is my fault, but forcing the type into integer could be useful to reduce errors like mine.
****
System details
OS: Centos 7
Python: 3.6
Library version: 0.9.1
Django: 1.11
****
Steps to reproduce the exception
In settings.py configure backupCount parameter as a string:
'backupCount': '30',
AS showed in the attached screenshot, even if the backupCount parameter is setted as integer at the BaseRotatingHandler class, on the emit method, the parameter self.backupCount is readed as str.