7.10 Scripts to executables
Note
Click here to download the full example code or to run this example in your browser via Binder
7.10 Scripts to executables#
import os
import sys
from collections import Counter
def main(path, start:int=26):
if not os.path.exists(path):
print(f"{path} does not exist.")
return
stations = [file[start:] for file in os.listdir(path)]
uniques = set(stations)
# find duplicates in stations
counts = Counter(stations)
duplicates = {item:count for item, count in counts.items() if count > 1}
if duplicates:
print(f"Found {len(duplicates)} duplicates in {path}")
for duplicate, count in duplicates.items():
print(f"{duplicate} found {count} times")
print(f"There are {len(uniques)} unique files.")
else:
print(f"No duplicates found in {path}")
No duplicates found in /home/docs/checkouts/readthedocs.org/user_builds/python-seekho/checkouts/dev/scripts/advanced
pyinstaller –onefile scripts_to_executables.py
dist/scripts_to_executables
dist/scripts_to_executables /mnt/datawaha/hyex/atr/gscad_database/raw/BOMAustralia/zip_files
dist/scripts_to_executables /mnt/datawaha/hyex/atr/gscad_database/raw/BOMAustralia/zip_files 26
Total running time of the script: ( 0 minutes 0.002 seconds)