Skip to content

Bug Report: Bug causing an uncaught exception when checking for an empty product list #205

Description

@peteGSX

Version

0.0.20

Bug description

Refer to DCC-EX/Support-Planning#945 for the user error reported.

@habazut narrowed it down to this method in file_manager.py:

def dir_is_empty(dir):
        """
        Check if directory is empty

        Returns True if so, False if not
        """
        if os.listdir(dir) > 0:
            return False
        else:
            return True

Steps to reproduce the bug

.

Expected behaviour

This method should return true or false based on the directory contents, not generate a type error.

Screenshots

No response

Additional context

The correct (and succinct) method should be:

def dir_is_empty(directory):
    """
    Check if directory is empty.

    Returns True if empty, False otherwise.
    """
    return len(os.listdir(directory)) == 0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working as designedEX-InstallerItem relates to EX-Installer

    Type

    No type

    Projects

    • Status
      To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions