pygooglechart
pygooglechart copied to clipboard
QR code creation fails when using / characters (as in a URL)
I wrote an incredibly simple program to input text and URLs from a file, parsed by the program, passed to pygooglechart, and then downloaded.
upon encountering a text file with a 'forward slash', the program crashes, apparently recognizing the text as a unix file path.
My program code:
!/usr/bin/python
import os import math import sys from pygooglechart import QRChart ROOT = os.path.dirname(os.path.abspath(file)) sys.path.insert(0, os.path.join(ROOT, '..')) text_file = open("urls.txt", "r") lines = text_file.readlines() print lines print len(lines) for line in lines: print line # Chart size chart = QRChart(400,400) # Chart text chart.add_data(line) # Set level of error correction, and 0 pixel margin chart.set_ec('H',0) # Download final image chart.download(line +".png") text_file.close()