tk5-c90-projects/tmp.py
2026-02-03 16:10:03 +00:00

29 lines
1.3 KiB
Python

# --------------------- DIAGNOSTICS: Prove temp file is created & readable ---------------------
print("\n--- TEMP FILE DIAGNOSTICS ---")
print(f"Current working directory: {os.getcwd()}")
print(f"Temp dir in use: {tempfile.tempdir}")
if os.path.exists(jcl_path): # jcl_path is the variable holding your temp file name/path
print(f"File exists: YES → {jcl_path}")
print(f"File size: {os.path.getsize(jcl_path)} bytes")
# Show basic permissions (octal, e.g. 0o644 = rw-r--r--)
st = os.stat(jcl_path)
print(f"Permissions (octal): {oct(st.st_mode & 0o777)}")
print(f"Owner UID: {st.st_uid} (your user should match os.getuid())")
# Try reading it back to prove readability
try:
with open(jcl_path, 'r') as f:
content = f.read()
print("File is readable! First 200 chars of content:")
print(repr(content[:200])) # repr() shows escapes/newlines clearly
print(f"... (total lines: {content.count('\n') + 1})")
except Exception as e:
print(f"Read failed: {e}")
else:
print("File exists: NO → something went wrong creating it")
print("--- END DIAGNOSTICS ---\n")