diff --git a/frontends/wechatapp.py b/frontends/wechatapp.py index aff57bf1..807ed4ce 100644 --- a/frontends/wechatapp.py +++ b/frontends/wechatapp.py @@ -415,7 +415,7 @@ def _send(show): print(f'[NEW] Process starting {time.strftime("%m-%d %H:%M")}') bot = WxBotClient() if _do_relogin or not bot.token: - if not sys.stdout.isatty(): + if not (sys.__stdout__ and sys.__stdout__.isatty()): print('[Bot] no token and not interactive, exit.'); sys.exit(1) sys.stdout = sys.stderr = sys.__stdout__ # restore for QR display bot.login_qr()