Closed iskandarreza closed 1 year ago
Python throws the error, "TypeError: 'SomeType' object is not subscriptable," when you attempt to use a bracket []
on an object that is not a list or dict, i.e. is not subscriptable. Currently line 346 of agent.py in clear_state()
is,
346: self.progress = None
The error, "TypeError: 'NoneType' object is not subscriptable," is thrown on line 441 of agent.py in config()
,
441: "progress": self.progress[:],
Switching line 346 to self.progress = []
fixes this, as you found. This is the same value assigned to self.progress
on line 60 of agent.py in __init__()
, so it seems like an acceptable solution to me.
Thinking I will add your example as a test case in test_serde.py as test_serde_after_clear_state()
and submit a PR. If you feel this test case should go into its own file, please let me know. In general, test coverage is pretty abysmal. It would be good to have a parallel file structure for unit tests and some proper mocking, imo, but that is a separate discussion.
Thanks a lot for opening the issue @iskandarreza!
Please check that this issue hasn't been reported before.
Expected Behavior
It shouldn't cause an error
Current behaviour
It throws the following error:
Steps to reproduce
Possible solution
Update line 346 in
agent.py
to this:Compare
Which Operating Systems are you using?
Python Version
LoopGPT Version
latest from main branch
Acknowledgements