Downloading and storing a PDF file to FileStore not working

msa_2j212
New Contributor II

I'm trying to download a PDF file and store it in FileStore using this code in a Notebook:

 

with open('/dbfs/FileStore/file.pdf', 'wb') as f:
    f.write(requests.get('https://url.com/file.pdf').content)

 

But I'm getting this error:

FileNotFoundError: [Errno 2] No such file or directory

What am I doing wrong?