[raygun4py] AttributeError: class RaygunErrorMessage has no attribute '__mro__'
k.art
Posted on
Nov 11 2016
Here is the traceback:
[..] our code here
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/raygun4py/raygunprovider.py", line 110, in send_exception
return self._post(message)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/raygun4py/raygunprovider.py", line 156, in _post
json = jsonpickle.encode(raygunMessage, unpicklable=False)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/__init__.py", line 131, in encode
warn=warn)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 42, in encode
return backend.encode(context.flatten(value, reset=reset))
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 142, in flatten
return self._flatten(obj)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 146, in _flatten
return self._pop(self._flatten_obj(obj))
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 162, in _flatten_obj
return flatten_func(obj)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 414, in _flatten_dict_obj
flatten(k, v, data)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 480, in _flatten_key_value_pair
data[k] = self._flatten(v)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 146, in _flatten
return self._pop(self._flatten_obj(obj))
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 162, in _flatten_obj
return flatten_func(obj)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 414, in _flatten_dict_obj
flatten(k, v, data)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 480, in _flatten_key_value_pair
data[k] = self._flatten(v)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 146, in _flatten
return self._pop(self._flatten_obj(obj))
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 162, in _flatten_obj
return flatten_func(obj)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 220, in _ref_obj_instance
return self._flatten_obj_instance(obj)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/pickler.py", line 350, in _flatten_obj_instance
if util.is_iterator(obj):
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/jsonpickle/util.py", line 341, in is_iterator
return (isinstance(obj, collections.Iterator) and
File "/Users/<user>/<folder>/env/lib/python2.7/abc.py", line 144, in __instancecheck__
return cls.__subclasscheck__(subtype)
File "/Users/<user>/<folder>/env/lib/python2.7/abc.py", line 180, in __subclasscheck__
if issubclass(subclass, scls):
File "/Users/<user>/<folder>/env/lib/python2.7/abc.py", line 161, in __subclasscheck__
ok = cls.__subclasshook__(subclass)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/backports_abc.py", line 66, in __subclasshook__
mro = C.__mro__
AttributeError: class RaygunErrorMessage has no attribute '__mro__'
raygun4py==3.1.1, Python 2.7.10
Upgrading to 3.1.3 gives me a different error:
[..] our code here
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/raygun4py/raygunprovider.py", line 97, in send_exception
errorMessage = raygunmsgs.RaygunErrorMessage(exc_type, exc_value, exc_traceback, options)
File "/Users/<user>/<folder>/env/lib/python2.7/site-packages/raygun4py/raygunmsgs.py", line 167, in __init__
if self.globalVariables:
AttributeError: RaygunErrorMessage instance has no attribute 'globalVariables'
This is my code (inside our application):
api_key = cfg.get('raygun', 'api_key')
from raygun4py import raygunprovider
client = raygunprovider.RaygunSender(api_key)
try:
raise ValueError('test')
except Exception, e:
client.send_exception(e)
Callum
Posted on
Nov 11 2016
Hm, this looks like a mismatch between a new-style class in python 2. As a workaround you can try replacing your client instantiation with this:
client = raygunprovider.RaygunSender('your_apikey', config={
'transmit_global_variables': False,
'transmit_local_variables': False
})
We'll debug this and get back to you with the results.
k.art
Posted on
Nov 11 2016
Thx. Unfortunately it throws the same error.
k.art
Posted on
Nov 29 2016
Hi Callum, any news on this? I would really like to log some errors ;-)
k.art
Posted on
Jan 04 2017
Happy New Year!!
Replacing the if self.globalVariables:
line with if hasattr(self, 'globalVariables'):
brings me back to the original issue:
AttributeError: class RaygunErrorMessage has no attribute '__mro__'