Hi Gunter Herd,

Sorry for super late reply. I hope you have figured it out by now, but if not, one of the reasons it might error out is because the directory you are trying to create the file in, does not exist. Python will not create the directory automatically (it will, however, for the file itself). So you need to ensure that the directory exists.

You can do something like os.path.exists(directory) to check whether the directory exists, and if not, create it os.mkdir(directory).

Written by

A passionate Software Engineer trying to leave a good legacy on earth

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store