mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-06-14 19:19:19 +08:00
Handle DataOverflowErrors.
This commit is contained in:
parent
14019c5168
commit
2853c6c0ad
@ -59,6 +59,14 @@ print("URLS:")
|
||||
print(qrData)
|
||||
print("")
|
||||
|
||||
print("Generating QR code...")
|
||||
|
||||
try:
|
||||
qrImage = qrcode.make(qrData, box_size=5)
|
||||
except qrcode.exceptions.DataOverflowError:
|
||||
print("Error: URL list too large for a QR code. Try reducing file name lengths or the number of files to send.")
|
||||
sys.exit(1)
|
||||
|
||||
print("Opening HTTP server on port 8080...")
|
||||
|
||||
server = TCPServer(("", 8080), SimpleHTTPRequestHandler)
|
||||
@ -66,10 +74,6 @@ thread = threading.Thread(target=server.serve_forever)
|
||||
thread.start()
|
||||
atexit.register(server.shutdown)
|
||||
|
||||
print("Generating QR code...")
|
||||
|
||||
qrImage = qrcode.make(qrData, box_size=5)
|
||||
|
||||
print("Displaying QR code...")
|
||||
|
||||
root = Tk()
|
||||
|
Loading…
x
Reference in New Issue
Block a user