Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError while using inject_environment_variables function #133

Open
djsam113 opened this issue Apr 1, 2021 · 0 comments
Open

AttributeError while using inject_environment_variables function #133

djsam113 opened this issue Apr 1, 2021 · 0 comments

Comments

@djsam113
Copy link

djsam113 commented Apr 1, 2021

When I parsed the Pipfile given in the example section, an attribute error came up because the line

requests = { extras = ['socks'] },

coz there is a list but it doesn't contain a dictionary. So just checking the type solved the issue.

def inject_environment_variables(d):
    if not d:
        return d
    for k, v in d.items():
        if isinstance(v, str):
            d[k] = os.path.expandvars(v)
        elif isinstance(v, dict):

            d[k] = inject_environment_variables(v)
        elif isinstance(v, list):
            for e in v:
                if type(e) == 'dict':
                    d[k] = inject_environment_variables(e)
                else:
                    continue
        return d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant