John77 John77 - 2 months ago 8
Python Question

Get file from Folder in Python

The issue has been reported here too.

I have code like:

from keras.datasets.data_utils import get_file

path = get_file('babi-tasks-v1-2.tar.gz', origin='http://www.thespermwhale.com/jaseweston/babi/tasks_1-20_v1-2.tar.gz')
tar = tarfile.open(path)


When I put the original file location (as the origin above) which is my Downloads folder;

/home/xxxxxx/Downloads/tasks_1-20_v1-2.tar.gz


I get the error:

ValueError: unknown url type: /home/xxxxxx/Downloads/tasks_1-20_v1-2.tar.gz


How to resolve the issue as the file location is actually correct?

Answer

The error message suggests that your library requires a resource type at the beginning of the URL. Try specifying your path like this:

file:/home/xxxxxx/Downloads/tasks_1-20_v1-2.tar.gz