Swagshop didn't run exploit code

I can’t run the exploit code (xml/webapps/37977.py)
I get this error
how can i solve it? (I think there is a problem with python)
Traceback (most recent call last):
File “/home/ma/Desktop/swagshop-exploit.py”, line 24, in
“filter”: base64.b64encode(pfilter),
File “/usr/lib/python3.11/base64.py”, line 58, in b64encode
encoded = binascii.b2a_base64(s, newline=False)
TypeError: a bytes-like object is required, not ‘str’