Skip to content

SyntaxError with Python 3.6 using SharePoint #829

Open
@gendergap

Description

@gendergap

I am trying to use this module inside an Ansible inventory script to retrieve hosts from a SharePoint list. This works well in a recent (3.11) Python version, but unfortunately I need to rely on Python 3.6 in another environment. There the script fails right away in line 1:

from office365.sharepoint.client_context import ClientContext

# [...] Authentication code like in this example: https://github.com/vgrem/Office365-REST-Python-Client/blob/master/examples/sharepoint/connect_with_client_certificate.py

The SyntaxError thrown is this:

Traceback (most recent call last):
  File "inventory-from-spo.py", line 1, in <module>
    from office365.sharepoint.client_context import ClientContext
  File "/home/me/.local/lib/python3.6/site-packages/office365/sharepoint/client_context.py", line 16, in <module>
    from office365.runtime.odata.request import ODataRequest
  File "/home/me/.local/lib/python3.6/site-packages/office365/runtime/odata/request.py", line 6, in <module>
    from office365.runtime.client_object import ClientObject
  File "/home/me/.local/lib/python3.6/site-packages/office365/runtime/client_object.py", line 1
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined

Is there some kind of compatibility layer one needs to activate?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions