def create_file(self, string=""): path = ezpath(self.path) if not os.path.isfile(path): f = open(self.path, "w") if string: f.write(string) f.close()
def open_file(self, pathname, arg): try: myfilepath = ezpath(pathname) myfile = open(myfilepath, arg) return myfile except IOError: myprint("File does not exist: " + pathname + "\n", bcolors.FAIL, True) self.edited = False raise IOError
def create_dir_if_not_already_there(pathname, dir_from_github=""): folder = ezpath(pathname) if not os.path.exists(folder): if dir_from_github: subprocess.call(["git", "clone", dir_from_github, folder]) else: print "Creating: " + folder os.makedirs(folder) return True else: print ("Folder already created: " + folder) False