| 12345678910111213141516171819202122232425262728 |
- import pathlib
- current = pathlib.Path(__file__).parent
- root = current.parent
- package = root / pathlib.Path("source")
- import sys
- sys.path.append(str(package))
- import pynstaller
- sample_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()
|