Three possibilities:
- The IDE inputs (e.g. arguments and environment variables) are not the same as the command line inputs. You can check that with print statements or logging.
- The libraries are not the same. I assume you know how to check this.
- You found a timing problem. To check this, first determine which element is erroring out, then try waiting before accessing that elementwaiting before accessing that element.