When I try to open a file in write mode with the following code:
packetFile = open("%s/%s/%s/%s.mol2" % ("dir", "dir2", "dir3", "some_file"), "w")
Gives me the following error:
IOError: [Errno 2] No such file or directory: 'dir/dir2/dir3/some_file.mol2'
The w
mode should create the file if it doesn't exist, right? So how can this error ever occur?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…