| 12345678910111213141516171819202122232425262728 | import pathlibcurrent = pathlib.Path(__file__).parentroot = current.parentpackage = root / pathlib.Path("source")import syssys.path.append(str(package))import pynstallersample_path = pathlib.Path("/etc/resolve.conf")sample_content = ("This is sample content").encode("utf-8")sample_file = pynstaller.file(sample_path, sample_content)print("Plain path: " + sample_file.path_name)print("Plain content: " + sample_file.content.decode("utf-8"))print()encoded_file = sample_file.encode()print("Encoded path: " + encoded_file.encoded_path)print("Encoded content: " + encoded_file.encoded_content)print()decoded_file = encoded_file.decode()print("Decoded path: " + decoded_file.path_name)print("Decoded content: " + decoded_file.content.decode("utf-8"))print()
 |