mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-06-15 03:29:16 +08:00
Handle DataOverflowErrors.
This commit is contained in:
parent
14019c5168
commit
2853c6c0ad
@ -59,6 +59,14 @@ print("URLS:")
|
|||||||
print(qrData)
|
print(qrData)
|
||||||
print("")
|
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...")
|
print("Opening HTTP server on port 8080...")
|
||||||
|
|
||||||
server = TCPServer(("", 8080), SimpleHTTPRequestHandler)
|
server = TCPServer(("", 8080), SimpleHTTPRequestHandler)
|
||||||
@ -66,10 +74,6 @@ thread = threading.Thread(target=server.serve_forever)
|
|||||||
thread.start()
|
thread.start()
|
||||||
atexit.register(server.shutdown)
|
atexit.register(server.shutdown)
|
||||||
|
|
||||||
print("Generating QR code...")
|
|
||||||
|
|
||||||
qrImage = qrcode.make(qrData, box_size=5)
|
|
||||||
|
|
||||||
print("Displaying QR code...")
|
print("Displaying QR code...")
|
||||||
|
|
||||||
root = Tk()
|
root = Tk()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user