Closed
Description
I've look at the source for this and the lpath doesn't start with root it throws an AssertionError.
drive = GoogleDrive() # inherits pydrive2.fs.GDriveFileSystem
with TableProgress(transient = False) as progress: # inherits rich.progress.Progress to overwrite def get_renderables(self) to wrap a table around the progress bar
info = drive.info(f'root/SpyBot/10-30-2024 12.31.35.zip')
task_id = progress.add_task(description = '', total = info['size'])
def callback_handler(_, value: int):
progress.update(task_id = task_id, completed = info['size'])
with fsspec.callbacks.Callback(
hooks = {
'progress': callback_handler
}
) as callback:
drive.get_file(lpath = rf'C:\Users\phpjunkie\Python\Scripts\scratches\temp{os.path.basename(info['name'])}', rpath = info['name'], block_size = 1 << 20, callback = callback)
sleep(1)
File "C:\Users\phpjunkie\AppData\Local\Programs\Python\Python312\Lib\site-packages\pydrive2\fs\spec.py", line 372, in _get_item_id
assert bucket == self.root
^^^^^^^^^^^^^^^^^^^
AssertionError
If I change lpath = rf'C:\Users\phpjunkie\Python\Scripts\scratches\temp{os.path.basename(info['name'])}',
to lpath = info['name'],
with . . .
os.makedirs(os.path.dirname(info['name']), exist_ok = True)
if os.path.exists(info['name']):
os.remove(info['name'])
before it to create the folder path, everything works just file. The assert bucket == self.root
is obviously checking if both the lpath
, and rpath
start with root in the folder path.