I am trying to set up a code which creates tickets by generating images of barcodes, from a txt file, and pasting that on the ticket image.
import barcode
import time
from barcode.writer import ImageWriter
mylist = []
with open('/Users/Droid/Desktop/my_project/Tickets/Tnumfile.TXT', 'r') as f:
for line in f.readlines(): #Walks through each line
code = barcode.get('code', line, writer=ImageWriter())
filename = code.save(line.strip()) #Saves Line 'tnumfile' as filename
mylist.insert(0,line.strip() + '.png')
time.sleep(2)
from PIL import Image
for item in mylist:
im1 = Image.open('/Users/Droid/Desktop/my_project/Ticket.png')
im2 = Image.open('/Users/Droid/Desktop/my_project/Tickets' + item)
area = (30, 1380, 553, 1660)
im1.paste(im2, area)
im1.save('line' + item)
supposed to run through .txt file converting all the barcodes to images and copying them onto the ticket image template, instead keeps telling me:
File "C:\Users\Droid\Desktop\my_project\Script.py", line 7, in <module>
code = barcode.get('code', line, writer=ImageWriter())
TypeError: 'NoneType' object is not callable