Check Action Type
https://github.com/hill-a/stable-baselines/issues/707
Description
TypeError: 'int' object is not subscriptable
Ran a couple time into this bug, and found it really hard to debug within stable baselines.
To spare others (as well as my future self) much frustration I would suggest to add a type check to wrapper envs like dummyEnv (or only check_env?) before using the action to make sure it's an iterable, before continuing with the code.
The following assertion will give a developer friendly error message that's easy to understand and offers an immediate solution, saving much frustration.
Motivation and Context
https://github.com/hill-a/stable-baselines/issues/707
- [x] I have raised an issue to propose this change
closes #707
Types of changes
- [x] New feature (non-breaking change which adds functionality)
Checklist:
- [x] I've read the CONTRIBUTION guide (required)
- [x] I have updated the changelog accordingly (required).
- [ ] My change requires a change to the documentation.
- [x] I have updated the tests accordingly (required for a bug fix or a new feature).
- [ ] I have updated the documentation accordingly.
- [ ] I have ensured
pytestandpytypeboth pass (by runningmake pytestandmake type).
Hello, thanks for the PR, please don't forget to add a test, and add your username to the changelog. note that some tests are failing because of an internal wrapper (unvecwrapper).
OK, added tests. I'm not sure though if it's the right approach to check each step of the base env if the action type received is compatible, as it seems a bit of unnecessary overhead. Maybe just check on the first run ?