-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Code that worked inside of a Jupyter Notebook in v0.3 of MSGraphFS no longer works in v0.4. Here is an example of code that runs without error when executed in a notebook cell in v0.3 but not in v0.4. The code runs successfully in v0.4 when executed as a script, so it seems to be the fact that Jupyter provides its own event loop that is tripping it up.
import os
import msgraphfs
from dsd_sharepointfs import get_access_token_interactive
token = get_access_token_interactive() # retrieves access token via public client flow
client_id = os.getenv("DSD_SHAREPOINT_FS_CLIENT_ID")
tenant_id = os.getenv("DSD_AZURE_TENANT_ID")
drive_id = "b!oc7uSdROqk-OOYAKmTu8MmOA9AXS2kZDs59EF92bPvUkJSHmL6ZzQJDueJUxFuGV"
fs = msgraphfs.MSGDriveFS(
client_id=client_id,
drive_id=drive_id,
oauth2_client_params = {
"token":token,
}
)
print(fs.ls("/", detail=False)[:5])Running inside a notebook cell with v0.4 gives the error
NotImplementedError: Calling sync() from within a running loop.
The same error is obtained when calling fs.open(). The error persists even if I pass in asyncio.get_event_loop() for the loop parameter of the MSGDriveFS constructor.
Metadata
Metadata
Assignees
Labels
No labels