Skip to content

AttributeError in get_subfolders() method #71

@MiaCreatech

Description

@MiaCreatech

Hey,

i got this traceback when using the folder.get_subfolders() method in v5.0.0 installed using pip:

Traceback (most recent call last):
  File "C:\...\test_outlook.py", line 16, in <module>
    pprint(folders.get_subfolders())
           ~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\...\venv\Lib\site-packages\pyOutlook\core\folder.py", line 90, in get_subfolders
    return self._json_to_folders(self.account, r.json())
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\...\venv\Lib\site-packages\pyOutlook\core\folder.py", line 50, in _json_to_folders
    return FolderService._json_to_folders(account, json_value)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "C:\...\venv\Lib\site-packages\pyOutlook\services\folder.py", line 85, in _json_to_folders
    return [self._json_to_folder(folder) for folder in json_value['value']]
            ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'OutlookAccount' object has no attribute '_json_to_folder'

I think the error is caused by line 108 in core/folder.py:

        from pyOutlook.services.folder import FolderService
        return FolderService._json_to_folders(account, json_value)

The object account is an instance of OutlookAccount and passed as self. Instanciating FolderService here (and in line 88 for _json_to_folder) fixes the problem.

        from pyOutlook.services.folder import FolderService
        service = FolderService(account)
        return service._json_to_folders(json_value)

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