Failsafe for lxml module, Choosing custom Markdown extensions

This commit is contained in:
2022-06-29 23:56:20 +02:00
parent 1962a808bc
commit 28dbca3ea3
2 changed files with 25 additions and 15 deletions

View File

@ -16,7 +16,7 @@ def ReadFile(p):
with open(p, 'r') as f:
return f.read()
except Exception:
print("Error reading file {}".format(p))
print("[E] Error reading file {}".format(p))
return None
def WriteFile(p, c):
@ -25,12 +25,16 @@ def WriteFile(p, c):
f.write(c)
return True
except Exception:
print("Error writing file {}".format(p))
print("[E] Error writing file {}".format(p))
return False
def FileToStr(File, Truncate=''):
return str(File)[len(Truncate):]
# https://stackoverflow.com/a/15664273
def IgnoreFiles(Dir, Files):
return [f for f in Files if os.path.isfile(os.path.join(Dir, f))]
def StripExt(Path):
return ".".join(Path.split('.')[:-1])