PyScripter has an editor option TrimTralingSpaces. Could it be that PyScripter stripped some trailing spaces?
....
if __name__ == '__main__':
main (sys.argv [1:])
# 01234567890
....
if __name__ == '__main__':
main (sys.argv [1:])
# 012345
....
if __name__ == '__main__':
main(sys.argv[1:])
#012345678
>>> print("🔒".encode("utf8"))
b'\xf0\x9f\x94\x92'
I analye my script and the problem is an function there translate an text special utf8 into an image.