• Как исправить ошибку [Errno 13] Permission denied?

    @rababo9996
    Developer
    Hi,

    You can try altering the filepath to a location where your program has the appropriate rights to write files to resolve this error. You could also use the 'tempfile' module to create a temporary file in a location where the program can write, and then send that file as the download instead.

    For example, you may change the 'filepath' line to read:

    import tempfile
    ...
    filename = "toplivo.xlsx"
    with tempfile.TemporaryDirectory() as tmpdir:
        filepath = os.path.join(tmpdir, filename)
        ...
        # Save workbook and return file for download


    This will create a temporary directory where your program is allowed to write files, and create the "toplivo.xlsx" file inside that directory.

    I hope this helps!
    Ответ написан
  • Как исправить скрипт?

    @rababo9996
    Developer
    Here's the corrected script:

    #!/bin/bash
    cd "$1"
    ls -la
    for file in $(ls "$1")
    do
    date=$(stat --printf '%w' "$file" | awk '{print $1}')
    test=$(echo "$file" | grep -o "$date")
    
    if [[ $test == '' ]]; then
    mv "$file" "$date-$file"
    fi

    done
    Ответ написан
    Комментировать