Skip to content

Ensure backup folder exists before writing post files (FileNotFoundError) #3

@biggenabw

Description

@biggenabw

Problem

Workflow fails with the error:

FileNotFoundError: [Errno 2] No such file or directory: 'backup/11.md'

This occurs because the code in Gmeek.py attempts to write to the backup directory without first ensuring the directory exists, causing workflow failures during the "Generate new html" step.

Solution

Update Gmeek.py, in the addOnePostJson method, to add the following line before opening or writing backup files:

import os
os.makedirs(self.backup_dir, exist_ok=True)

This creates the backup folder if it does not already exist, preventing the FileNotFoundError.

Acceptance Criteria

  • The workflow no longer fails with FileNotFoundError related to the backup directory.
  • The Gmeek.py script creates the backup directory if missing.

Context

See failing job logs for details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions