简体   繁体   中英

I'm unable to upload files to my Jupyter Notebook on Google Colab

On the Files tab on the left I click the Upload button to upload a file called titanic_train.csv . However, the image goes to the bottom of the files tab and just stays there, never becoming accessible to my programs,

titanic_train.png永远不会上传

As a workaround, I also tried uploading via Google Colab's built-in google.colab.files.upload method, which successfully prompts me for a file, but then stalls at 0% uploaded with the message:

titanic_train.csv(text/csv) - 72499 bytes, last modified: 9/20/2018 - 0% done

Viz,

上传速度为0%

Does anyone have an idea of what I may be doing wrong, or how I could resolve this so my programs can successfully access files via Google Colab?

I'm doing this with Chrome on Ubuntu 16.04.

Using safari caused some issues when I tried uploading, did you try Chrome? That worked for me. Also try uploading with this code. This one also lets you save the file, so you don't have to upload it every 12 hours.

def upload_files():
  from google.colab import files
  uploaded = files.upload()
  for k, v in uploaded.items():
    open(k, 'wb').write(v)
  return list(uploaded.keys())

upload_files()

The problem was the permissions on my file. It's the famous Titanic Survivor dataset, which I downloaded from Kaggle. The file came with a permission of No Read, No Write, No Execute:

me@fakehost:~/titanic-dataset$ ls -l
total 116
---------- 1 hc-16 hc-16  2843 sep 20  2018 gender_baseline.csv
---------- 1 hc-16 hc-16 39299 sep 20  2018 titanic_test.csv
---------- 1 hc-16 hc-16 72499 sep 20  2018 titanic_train.csv

Chrome can't upload the file because it has no read access, so this is fixed as easy as chmod 400 *

Huge relief, I can't imagine why Kaggle gives these files a permission of 000 to begin with.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM