def makeDirectory(self, path): u"""Make sure that the directory of path (as file) exists. Otherwise create it. Answer the directory path for convenience of the caller.""" dirPath = TX.path2Dir(path) if not os.path.exists(dirPath): os.makedirs(dirPath) return dirPath
def save(self, path, makeDirectory=False): u"""Save the file in path. If <i>makeDirectory</i> is <b>True</b> (default is <b>False</b>) then create the directories in the path if they don’t exist.""" if makeDirectory: dirPath = TX.path2Dir(path) if not os.path.exists(dirPath): os.makedirs(dirPath) f = open(path, 'wb') f.write(self.getResult()) f.close()
def makeDirectory(self, path): u"""Make sure that the directory of path (as file) exists. Otherwise create it.""" dirPath = TX.path2Dir(path) if not os.path.exists(dirPath): os.makedirs(dirPath)