I'm new to Python and I want to know the best way to handle the following error:
downloaded = raw_input("Introduce the file name: ").strip()
f, metadata = client.get_file_and_metadata('/'+downloaded)
#print 'metadata: ', metadata['mime_type']
out = open(downloaded, 'wb')
out.write(f.read())
out.close()
If I set a wrong name I get this error:
dropbox.rest.ErrorResponse: [404] u'File not found'
I could write a function to check if the file exists but I want to know If I can handle it in a better way.