fsspec / gdrivefs

Google drive implementation of fsspec
BSD 2-Clause "Simplified" License
38 stars 20 forks source link

Example script gives error #27

Open richardblythman opened 2 years ago

richardblythman commented 2 years ago

I installed gdrivefs using pip. When I run your example script (in example_w_xarray_zarr.ipynb):

import gdrivefs
# use this the first time you run
token = 'browser'
# use this on subsequent attempts
#token = 'cache'

# shareable link to folder generated with
# https://drive.google.com/open?id=1FQzXM2E28WF6fV7vy1K7HdxNV-w6z_Wx
root_file_id = '1FQzXM2E28WF6fV7vy1K7HdxNV-w6z_Wx'

gdfs = gdrivefs.GoogleDriveFileSystem(token=token, root_file_id=root_file_id)
gdfs

I get the following error: AttributeError: module 'gdrivefs' has no attribute 'GoogleDriveFileSystem'

martindurant commented 2 years ago

It is right here in the package init. Perhaps you have another file called "gdrivefs.py" or "gdrivefs/" on your path that python is picking up?

richardblythman commented 2 years ago

I installed with pip, not from source. And nope, no issues with path.

The __init__.py that's downloaded with pip only has one line: __version__ = '0.14.13'

martindurant commented 2 years ago

I see. So it seems there is a name conflict: this gdrivefs has never been released on PyPI (or elsewhere), you can only install it directly

pip install git+https://github.com/fsspec/gdrivefs

or by cloning the repo by hand. I suppose in your case you would need to uninstall the other gdrivefs, which is something else, a CLI and FUSE layer.

I was not at all aware of the other project, we could probably merge the code here into theirs, especially since they appear to have solved the auth situation in a robust way.

cc @dsoprea

richardblythman commented 2 years ago

Ah, didn't spot that. OK this explains it. Thanks for your help.