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

'MailChimpError' object is not subscriptable #219

Open
miguoliang opened this issue Dec 14, 2019 · 5 comments
Open

'MailChimpError' object is not subscriptable #219

miguoliang opened this issue Dec 14, 2019 · 5 comments

Comments

@miguoliang
Copy link

    try:
        members = client.lists.members.create('xxxxxx', {
            'email_address': 'example@123.com,
            'status': 'subscribed'
        })
    except MailChimpError as e:
        print(e['status'])
    return {
        'status': 200
    }

I run the above code, it should raise a MailChimpError exception, but when I try to read the property status, I got a new exception that 'MailChimpError' object is not subscriptable.

How can I fix it?

@michaelwalkerfl
Copy link
Contributor

If you update your code to print(e[0]['status']) it will return the status code you desire without an error.

@ghost
Copy link

ghost commented Dec 21, 2019

I have similar code if I do the e[0]["status"] think it just says "TypeError: 'MailChimpError' object does not support indexing" instead.

@marcomayer
Copy link

I did run into the same issue, surely is broken currently. Workaround:
print(e.args[0].get("status"))

@ghost
Copy link

ghost commented Jun 2, 2020

I have the same issue. Using 3.0.14

@Jake-Mulhern
Copy link

I am running into the same issue. Has a solution to this been implemented?

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

4 participants