googlecolab / colabtools

Python libraries for Google Colaboratory
Apache License 2.0
2.17k stars 707 forks source link

Google Colab from Google Drive opens old version #245

Closed BrazilForever11 closed 4 months ago

BrazilForever11 commented 6 years ago

It appears that when opening files from Google Drive in Google Colab it opens old version. Here are the step to replicate

1) Create new notebook on you local machine in Google Drive folder. Enter the following into notebook: "# Initial text". 2) Save notebook under "Notebook_1.ipynb" and shut it down in Jupyter screen 3) Go to online interface of Google Drive and find "Notebook_1.ipynb" (you might need to give it some time to sync) 4) Open "Notebook_1.ipynb" in Google Colab from online interface of Google Drive. Everything should be intact. 5) Now go back to local machine and edit "Notebook_1.ipynb". Add line "# Additonal text". Close it and shut it down. Note time when you shut it down 6) Go to online interface of Google Drive and make sure that new sync time is reflected. 7) Open with Google Colab from online interface of Google Drive. The second line "# Additonal text" will not be there.

Sorry for lengthy description. Any suggestions.

colaboratory-team commented 6 years ago

Thanks for the report, and sorry for the trouble.

An immediate work-around is to append the string #offline=1 to the URL, e.g., https://colab.research.google.com/drive/your-file-id#offline=1

Under the covers, the problem is that there are two copies of your document: 1) an internal representation used for realtime synchronization, and 2) a mirror copy saved to Drive as JSON. I suspect what is causing this problem is that you are editing the JSON without updating the realtime version, which Colab will load on startup.

We're planning some changes to smooth this flow, but they aren't quite ready yet. We'll leave this issue open until those land. Again, for now, your best bet is to use the #offline=1 URL parameter when editing the JSON outside of Colab.

BrazilForever11 commented 6 years ago

Thank you for prompt reply and nice workaround.

I noticed that smaller files are not affected as much as big notebooks. Also, I guess I am in playground mode now and need to use Colab for execution mostly. I mean no saving with "#offline=1" option possible.