Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to upload local files: google.colab.__files is undefined #51

Closed
xprilion opened this issue Feb 8, 2018 · 20 comments
Closed

Unable to upload local files: google.colab.__files is undefined #51

xprilion opened this issue Feb 8, 2018 · 20 comments
Assignees

Comments

@xprilion
Copy link

xprilion commented Feb 8, 2018

Using the file upload code snippet on both python3 and python2 I get the error message:

---------------------------------------------------------------------------
MessageError                              Traceback (most recent call last)
<ipython-input-3-292f82be1b7a> in <module>()
      1 from google.colab import files
      2 
----> 3 uploaded = files.upload()
      4 
      5 for fn in uploaded.keys():

/usr/local/lib/python3.6/dist-packages/google/colab/files.py in upload()
     59   result = output.eval_js(
     60       'google.colab._files._uploadFiles("{input_id}", "{output_id}")'.format(
---> 61           input_id=input_id, output_id=output_id))
     62   files = collections.defaultdict(six.binary_type)
     63 

/usr/local/lib/python3.6/dist-packages/google/colab/output/_js.py in eval_js(script, ignore_result)
     37   if ignore_result:
     38     return
---> 39   return _message.read_reply_from_input(request_id)
     40 
     41 

/usr/local/lib/python3.6/dist-packages/google/colab/_message.py in read_reply_from_input(message_id, timeout_sec)
     84         reply.get('colab_msg_id') == message_id):
     85       if 'error' in reply:
---> 86         raise MessageError(reply['error'])
     87       return reply.get('data', None)
     88 

MessageError: TypeError: google.colab._files is undefined
@craigcitro
Copy link
Contributor

I can't seem to reproduce this -- does this always happen, or only sometimes?

If you open the chrome JS console (ctrl-shift-j or cmd-shift-j on a mac), do you have any errors there?

@blois
Copy link
Contributor

blois commented Feb 8, 2018

Which browser is this occurring in? If Chrome, are you seeing a warning when initially opening the document?

@xprilion
Copy link
Author

xprilion commented Feb 9, 2018

I am using Firefox 58.0.1 (64 bit) on Ubuntu 17.10 with lxqt env

@blois blois self-assigned this Feb 9, 2018
@blois
Copy link
Contributor

blois commented Feb 14, 2018

I'm working on a fix for this, in the meantime I would recommend using Chrome. This is specifically running into https://bugzilla.mozilla.org/show_bug.cgi?id=1279406.

@rocarvaj
Copy link

I'm also experiencing the same issue on Safari 11.0.3. I guess I'll stick to Chrome.

@blois
Copy link
Contributor

blois commented Feb 14, 2018

Safari's Service Worker implementation is available in the preview version, though we haven't had a chance to test them yet. See https://webkit.org/status/#specification-service-workers.

@hynekcer
Copy link

I am adding some context for other people because I found a link to this issue from an stackoverflow answer.

Shortly: Chrome works if third-party cookies are enabled in settings. No easy or complicated solution exists currently for Firefox (that say posts above)

I wrote some summary about files.upload(), especially for people that search a solution by error messages.

@hynekcer
Copy link

It would be nice to customize the message

Upload widget is only available when the cell has been executed in the current browser session. Please rerun this cell to enable.

and replace the words "Please rerun this cell to enable." by "This browser is probably not supported for upload." if detected by some simple whitelist or blacklist.

This will help very much temporarily. (question "I rerun the cell but it doesn't work...")

It also helps to get more complete questions or issue reports because all four questions at stackoverflow that I found (and fixed little) were without information about the browser and sometimes neither considered it in answers. (like "I have no problem.")

@guptasaurabh9868
Copy link

It is also happening in google chrome.

@blois
Copy link
Contributor

blois commented Aug 28, 2018

There is a new file upload UI in the notebook sidebar, alongside the table of contents.

@blois blois closed this as completed Aug 28, 2018
@martosinc
Copy link

martosinc commented Jun 7, 2020

You can also just reimport all your packages

@chez8990
Copy link

image
It's been 3 years and I'm still getting this error

@craigcitro
Copy link
Contributor

@chez8990 could I ask you to file a new issue and include (1) info about what browser you're using and (2) whether it works in an incognito window?

@myaouri
Copy link

myaouri commented Dec 23, 2021

@chez8990 Could you please tell me on which browser have you been having this issue? If it's firefox, I had a fix for mine.

@ankur-bohra
Copy link

@myaouri I'm running into this issue on Firefox, sharing the solution would be appreciated.

@myaouri
Copy link

myaouri commented Dec 28, 2021

@ankur-bohra Under 'Cookies and Site Data' I simply unchecked 'Delete cookies and site data when Firefox is closed' from Privacy and Security from firefox preferences. My Firefox version : 91.4.1es

Screen Shot 2021-12-27 at 11 42 30 PM

r

@ichsanputr
Copy link

ichsanputr commented Mar 17, 2022

Just information if you get error message like this

Upload widget is only available when the cell has been executed in the current browser session. Please rerun this cell to enable.

thats mean your current browser not supported to do this, for fix you can use Firefox browser (this work for me)

Screenshot from 2022-03-17 10-32-46

@nothingface0
Copy link

For Firefox, you might have to disable Tracking Protection
image

@izadimasoome
Copy link

hi thanks.......I tried it with chrome and got the result

@JackSCJackson
Copy link

JackSCJackson commented Sep 9, 2022

Issue happening with latest chrome version, anyone got a fix?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests