Open pointyointment opened 6 years ago
files.download
doesn't understand what to do with a folder. for now, tar it up and you should be okay.
let's use this issue to track a better error in that case.
Solution 1: Error out
if os.path.isdir(filename):
raise ValueError("filename: must not be a directory")
Pro: simple Contra: useless
Solution 2: Download one by one
if os.path.isdir(filename):
directory = filename
for filename in os.listdir():
download(os.path.join(directory, filename))
return
Pro: straight-forward Contra: painful
Solution 3: Download as archive
import shutil
if os.path.isdir(filename):
filename = os.path.normpath(filename)
filename = shutil.make_archive(filename, 'zip', filename)
download(filename)
return
Pro: works Contra: none
how do I get the file path for os.chdir
if the file is in github?
I was trying to download the configuration so I could just reupload it in the future instead of going through all of the OAuth/API key steps every time I run the notebook.
Typical
google-drive-ocamlfuse
setup:That all succeeds.
Attempt to download
.gdfuse
folder using the technique shown in the external data notebook:That gives this output:
There's no further explanation given for the failure, though it looks like there should be. I tried to search for other people having this problem and didn't find any. There is Issue #83, but the problem there was determined to be that the file was too large, which a configuration folder shouldn't be.