C3W4 - No such file or directory: './sonnets.txt'

when i opened colab and i ran the code:

Define path for file with sonnets

SONNETS_FILE = ‘./sonnets.txt’

Read the data

with open(‘./sonnets.txt’) as f:
data = f.read()
i got error No such file or directory: ‘./sonnets.txt’. How can I fix this?

Check the files on the folder icon on the top left where is that file located and coppy the exact path to the python command in colab!

I still don’t understand where to fetch, does the issue come from the !gdown code block?

I have no access to this specialization, but if you download it as a file on the top cells, then it should be somewhere in the files. If you cant download it thats another problem!

Thank you for your concern. Could someone who has done this assignment lend me a hand with this issue, please?

So finaly i have to fix it by another way that I follow the link https://drive.google.com/uc?id=108jAePKK4R3BVYBbYJZ32JWUwxeMg20K. It will download a sonnet.txt file to your local and you have to load it on colab, so that you can use that file normally.

4 Likes

Hi! Glad you were able to work around it. Sorry there might be a problem with the gdown utility. We just updated the notebook with a compatible version so other learners won’t run into the issue. Thank you for reporting!

1 Like

Thank you for this. I had the same issue today and now i am able to move forward with the assignment.