ajout de verification de existence fichier

This commit is contained in:
Valentin CZERYBA 2023-04-06 20:59:11 +02:00
parent ba511bc6c4
commit 5768b37cd1

View File

@ -15,6 +15,7 @@ class WPimport:
def fromFile(self, files): def fromFile(self, files):
for file in files.split(","): for file in files.split(","):
if os.path.exists(file):
with open(file, 'r') as f: with open(file, 'r') as f:
content = f.read() content = f.read()
soup = BeautifulSoup(content, 'html.parser') soup = BeautifulSoup(content, 'html.parser')