File size: 340 Bytes
26ee80c
 
 
c382300
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import os

def ensure_output_dir():
    """Ensure the output directory exists and is writable."""
    output_dir = os.path.join(os.getcwd(), "output")
    if not os.path.exists(output_dir):
        os.makedirs(output_dir)
    # Ensure the directory is writable
    if not os.access(output_dir, os.W_OK):
        os.chmod(output_dir, 0o777)