diff --git a/sanic/mixins/runner.py b/sanic/mixins/runner.py index 1df77e551e..30645b2b1d 100644 --- a/sanic/mixins/runner.py +++ b/sanic/mixins/runner.py @@ -424,7 +424,7 @@ def _helper( self.motd(self.serve_location) - if sys.stdout.isatty() and not self.state.is_debug: + if sys.stdout and sys.stdout.isatty() and not self.state.is_debug: error_logger.warning( f"{Colors.YELLOW}Sanic is running in PRODUCTION mode. " "Consider using '--debug' or '--dev' while actively "