harbor run -t openthoughts/tasktrove-exp-rpt-curriculum-easy-curriculum-easy-0504harbor download openthoughts/tasktrove-exp-rpt-curriculum-easy-curriculum-easy-0504Goal
What to build
Simplified approach and hints
Skeleton (start you can base on)
#!/usr/bin/env python3
import os
import sys
def main():
if len(sys.argv) != 2:
print("Usage: list_files.py <output_path>", file=sys.stderr)
return 2 # improper usage
out_path = sys.argv[1]
names = []
try:
with os.scandir('.') as it:
for entry in it:
if entry.name.startswith('.'):
continue
if entry.is_file(follow_symlinks=True):
names.append(entry.name)
except OSError as e:
print(f"Error scanning directory: {e}", file=sys.stderr)
return 1
names.sort()
try:
with open(out_path, 'w', encoding='utf-8') as f:
for n in names:
f.write(n + "\n")
except OSError as e:
print(f"Error writing output file: {e}", file=sys.stderr)
return 1
return 0
if __name__ == "__main__":
raise SystemExit(main())
Files and naming