Bug report for Colab: http://colab.research.google.com/.
For questions about colab usage, please use stackoverflow.
- Describe the current behavior:
from google.colab.files import upload
This function creates a convenient way to upload files. When a user runs the function and uploads a file, it returns an object with {"filename": "data"}. However, built into this function is the ability to increment the filename, if needed, should there be a file that already exists with the same name. The function does NOT return the incremented filename (it only prints it).
- Describe the expected behavior:
When the user runs the cell again and uploads a file of the same name, the function is currently designed to add a counter to the filename. This is helpful to not overwrite the original file; however, the function prints the new name, but only returns the original name. It is difficult to access the LATEST file upload since the return value does not include the modified filename.
I would argue this is misleading. If a user makes a change to their file and re-uploads it with the same filename, this function is going to return the ORIGINAL filename and not the modified filename.
Thus, it may go unnoticed to the user that the return value from this function is still referring only to the unmodified filename from the original upload. Since that file exists, it is likely that this error will not be noticed and the remainder of the notebook will not be using the intended file.