Skip to content

find_git raises KeyError on 32 bt windows #290

@carlost

Description

@carlost

find_git in git.py uses os.environ to get environment values for "ProgramFiles" and "ProgramFiles(x86)". Unfortunately, 32-bit windows doesn't have a key set for "ProgramFiles(x86)". The dictionary returned by os.environ will raise a KeyError because a key of "ProgramFiles(x86)" is not present.

if os.name == 'nt':
    extra_paths = (
        os.path.join(os.environ["ProgramFiles"], "Git", "bin"),
        os.path.join(os.environ["ProgramFiles(x86)"], "Git", "bin"),
    )

My python is pretty rank but you may want to replace this with a call to os.environ.get or os.getenv. Those seem to be far more forgiving ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions