Inky phat: QR script not working

Hi, im new to all this and im trying to create a QR image using the example script from the original inky script and i can’t seem to get it to work.

I keep getting

ValueError: cannot determine region size; use 4-item box

could anyone lend me a hand on where I even begin?


#!/usr/bin/env python3

import sys

import os
from PIL import Image
import qrcode
from import auto
inky_display = auto()

print(""“Inky pHAT: QR Code
Display a QR Code on Inky pHAT!
Usage: {} “””.format(sys.argv[0]))

Max length is 152

text = “”“In the old #BILGETANK we’ll keep you in the know,
In the old #BILGETANK we’ll fix your techie woes.”""

if len(sys.argv) < 2:
print(""“Valid colours for v2 are: red, yellow or black
Inky pHAT v1 is only available in red.”"".format(sys.argv[0]))

colour = sys.argv[1]

if len(sys.argv) > 2:
text = sys.argv[2]

class InkyQR(qrcode.image.base.BaseImage):
def new_image(self, **kwargs):
self.offset_x = kwargs.get(“offset_x”, None)
self.offset_y = kwargs.get(“offset_y”, None)

    if self.pixel_size - (self.border * 2) > min(inky_display.WIDTH, inky_display.HEIGHT):
        print("QR code is too large for Inky pHAT, it probably wont scan! Try `box_size=1`")

    if self.offset_x is None:
        self.offset_x = (inky_display.WIDTH // 2) - (self.pixel_size // 2)
    if self.offset_y is None:
        self.offset_y = (inky_display.HEIGHT // 2) - (self.pixel_size // 2)

    box = (self.offset_x, self.offset_y, self.offset_x + self.pixel_size - 1, self.offset_y + self.pixel_size - 1)
    inky_display.rectangle(box, fill=inky_display.WHITE)

def pixel_box(self, row, col):
    x = (col + self.border) * self.box_size
    y = (row + self.border) * self.box_size
    x += self.offset_x
    y += self.offset_y
    return [(x, y), (x + self.box_size - 1, y + self.box_size - 1)]

def drawrect(self, row, col):
    box = self.pixel_box(row, col)
    inky_display.rectangle(box, fill=inky_display.BLACK)


qr = qrcode.QRCode(