builtins.TypeError: _findCaller() takes from 1 to 2 positional arguments but 3 were given in django
Question:
I have a scraping project with django. Everything work fine, but terminal shows this error:
builtins.TypeError: _findCaller() takes from 1 to 2 positional arguments but 3 were given
What is this error?
How can I handle it?
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 134, in err
msg(failure=_stuff, why=_why, isError=1, **kw)
File "/usr/lib/python3/dist-packages/twisted/python/threadable.py", line 53, in sync
return function(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 286, in msg
_publishNew(self._publishPublisher, actualEventDict, textFromEventDict)
File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 154, in publishToNewObserver
observer(eventDict)
--- <exception caught here> ---
File "/usr/lib/python3/dist-packages/twisted/logger/_observer.py", line 131, in __call__
observer(event)
File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 93, in __call__
self.legacyObserver(event)
File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 595, in emit
_publishNew(self._newObserver, eventDict, textFromEventDict)
File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 154, in publishToNewObserver
observer(eventDict)
File "/usr/lib/python3/dist-packages/twisted/logger/_stdlib.py", line 115, in __call__
self.logger.log(
File "/usr/lib/python3.8/logging/__init__.py", line 1500, in log
self._log(level, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1565, in _log
fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
builtins.TypeError: _findCaller() takes from 1 to 2 positional arguments but 3 were given
Answers:
This could be result of compatibility with older versions as per the documention in ..logging/__init__.py
setting _srcfile = None
should avoid raising TypeError
_srcfile is only used in conjunction with sys._getframe().
To provide compatibility with older versions of Python, set _srcfile
to None if _getframe() is not available; this value will prevent
findCaller() from being called. You can also do this if you want to avoid
the overhead of fetching caller information, even when _getframe() is
available.
if not hasattr(sys, '_getframe'):
_srcfile = None
Please try this: pip install -U twisted
then do pip install -U attrs
I have a scraping project with django. Everything work fine, but terminal shows this error:
builtins.TypeError: _findCaller() takes from 1 to 2 positional arguments but 3 were given
What is this error?
How can I handle it?
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 134, in err
msg(failure=_stuff, why=_why, isError=1, **kw)
File "/usr/lib/python3/dist-packages/twisted/python/threadable.py", line 53, in sync
return function(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 286, in msg
_publishNew(self._publishPublisher, actualEventDict, textFromEventDict)
File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 154, in publishToNewObserver
observer(eventDict)
--- <exception caught here> ---
File "/usr/lib/python3/dist-packages/twisted/logger/_observer.py", line 131, in __call__
observer(event)
File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 93, in __call__
self.legacyObserver(event)
File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 595, in emit
_publishNew(self._newObserver, eventDict, textFromEventDict)
File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 154, in publishToNewObserver
observer(eventDict)
File "/usr/lib/python3/dist-packages/twisted/logger/_stdlib.py", line 115, in __call__
self.logger.log(
File "/usr/lib/python3.8/logging/__init__.py", line 1500, in log
self._log(level, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1565, in _log
fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
builtins.TypeError: _findCaller() takes from 1 to 2 positional arguments but 3 were given
This could be result of compatibility with older versions as per the documention in ..logging/__init__.py
setting _srcfile = None
should avoid raising TypeError
_srcfile is only used in conjunction with sys._getframe().
To provide compatibility with older versions of Python, set _srcfile
to None if _getframe() is not available; this value will prevent
findCaller() from being called. You can also do this if you want to avoid
the overhead of fetching caller information, even when _getframe() is
available.
if not hasattr(sys, '_getframe'):
_srcfile = None
Please try this: pip install -U twisted
then do pip install -U attrs