Advertisement
Kovitikus

Tavis Question

Nov 9th, 2020
1,798
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. # [11:58 PM] Tavis: Hello I am getting a really odd error here...
  2.  
  3. # I have an example class like so:
  4. class Test:
  5.     __conditionname__ = "example"
  6.     def __init__(self, caller, X=None):
  7.         self.caller = caller  # designed to be typeclasses.characters.Character
  8.  
  9.         self.meta = dict()
  10.         self.X = X
  11.         self.enabled = True
  12.         self.multiple = False
  13.  
  14.  
  15. # This class instance is also designed to be stored on a typeclass attribute handler like so:
  16.  
  17. class Character(DefaultObject):
  18.   ...
  19.   def foo(self):
  20.     test = Test(self, X=None)
  21.     self.db.myattr = {}
  22.     self.db.myattr['test'] = test # ERROR
  23.  
  24.  
  25. # With the most recent traceback of:
  26. # ~/evennia/evennia/utils/picklefield.py in dbsafe_encode(value, compress_object, pickle_protocol)
  27. #     101         value = pack_dbobj(value)
  28. #     102
  29. # --> 103     value = dumps(value, protocol=pickle_protocol)
  30. #     104
  31. #     105     if compress_object:
  32.  
  33. # TypeError: 'NoneType' object is not callable
  34.  
  35.  
  36. # It turns out that assigning the self.caller to Test breaks the code with the error above.
  37.  
  38. # I can't save the self.caller to  class which is then stored as an attribute on said caller??
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement