diff --git a/channel/wechat/wechat_channel.py b/channel/wechat/wechat_channel.py index 8b44554..fffb22b 100644 --- a/channel/wechat/wechat_channel.py +++ b/channel/wechat/wechat_channel.py @@ -10,6 +10,7 @@ import os import threading import time import requests +import sys from bridge.context import * from bridge.reply import * @@ -100,7 +101,10 @@ def qrCallback(uuid, status, qrcode): qr = qrcode.QRCode(border=1) qr.add_data(url) qr.make(fit=True) - qr.print_ascii(invert=True) + try: + qr.print_ascii(invert=True) + except UnicodeEncodeError: + print("ASCII QR code printing failed due to encoding issues.") @singleton