Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

QR code creation fails when using / characters (as in a URL) #2

@tomswartz07

Description

@tomswartz07

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()

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions