open("output/mainwindow.h",'w') doesn't create a folder for me

Michael Hoffman cam.ac.uk at mh391.invalid
Wed May 2 10:06:46 EDT 2007


noagbodjivictor at gmail.com wrote:
> Hello
> I have done python for some time now. I'm forgetting things.
> 
> This is the faulty line : outfile = open("output/mainwindow.h",'w')
> 
> I thought it would have created the folder ouput and the file
> mainwindow.h for me but it's throwing an error

No, you have to create the folder first. Try os.makedirs()
-- 
Michael Hoffman



More information about the Python-list mailing list