aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PyQRNative.py4
-rwxr-xr-xpyAggr3g470r.py18
2 files changed, 15 insertions, 7 deletions
diff --git a/PyQRNative.py b/PyQRNative.py
index 2d3dd489..929e8e49 100644
--- a/PyQRNative.py
+++ b/PyQRNative.py
@@ -278,9 +278,9 @@ class QRCode:
if (buffer.getLengthInBits() > totalDataCount * 8):
raise Exception("code length overflow. ("
- + buffer.getLengthInBits()
+ + str(buffer.getLengthInBits())
+ ">"
- + totalDataCount * 8
+ + str(totalDataCount * 8)
+ ")")
#// end code
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index 45341381..eb1597d2 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -362,13 +362,21 @@ class Root:
for article in articles_list:
if article_id == article[0]:
+ try:
+ os.makedirs("./var/qrcode/")
+ except OSError:
+ pass
if not os.path.isfile("./var/qrcode/"+article_id+".png"):
# QR code generation
- qr = PyQRNative.QRCode(5, PyQRNative.QRErrorCorrectLevel.L)
- qr.addData(article[3])
- qr.make()
- im = qr.makeImage()
- im.save("./var/qrcode/"+article_id+".png", format='png')
+ try:
+ qr = PyQRNative.QRCode(15, PyQRNative.QRErrorCorrectLevel.L)
+ qr.addData(article[3])
+ qr.make()
+ im = qr.makeImage()
+ im.save("./var/qrcode/"+article_id+".png", format='png')
+ except Exception, e:
+ # Code length overflow
+ print e
if article[5] == "0":
self.mark_as_read("Article:"+article[3]) # update the database
bgstack15