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?

Code:

#!/usr/bin/env python3

import sys

import os
from PIL import Image
import qrcode
from inky.auto 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.
https://www.youtube.com/pimoroniltd”“”

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]))
sys.exit(1)

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)

inky_display.set_image(“/home/pi/Pimoroni/inky/examples/phat/resources/empty-backdrop.png”)

qr = qrcode.QRCode(
version=1,
box_size=2,
border=2,
image_factory=InkyQR
)

qr.add_data(text)
qr.make(fit=True)
qr.make_image()

inky_display.show()