Skip to content
This repository was archived by the owner on Sep 9, 2021. It is now read-only.
This repository was archived by the owner on Sep 9, 2021. It is now read-only.

Unable to send an email after upgrade to Python 3.7 #7

@rafalbilski

Description

@rafalbilski

Traceback (most recent call last):
File "tmp.py", line 14, in
mail.send_message(message)
File "/usr/lib/python3.7/site-packages/office365api/mail/base.py", line 76, in send_message
data = message.data
File "/usr/lib/python3.7/site-packages/office365api/model/model.py", line 59, in data
return {self.class.name: dict(self)}
File "/usr/lib/python3.7/site-packages/office365api/model/model.py", line 8, in getattr
return self[name]
TypeError: 'Message' object is not subscriptable

Your code worked fine in Python 3.6. Thanks!
By trial and error I found out that modification below fixes this issue for Python 3.7. I didn't test it on any other Python versions as code only runs on one dedicated server.

class Model(object):

def __getattr__(self, name):
    try:
        **return super().getattr(name)**
    except KeyError:
        raise AttributeError(name)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions