From a3374ebe65cca1adad2221eaa913e0f76877b2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volkan=20=C5=9Eahin?= Date: Wed, 21 Sep 2016 11:46:46 +0300 Subject: [PATCH] check file exist for removing --- opt/ahenk/base/util/util.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/opt/ahenk/base/util/util.py b/opt/ahenk/base/util/util.py index 364f3a3..432346d 100644 --- a/opt/ahenk/base/util/util.py +++ b/opt/ahenk/base/util/util.py @@ -2,15 +2,15 @@ # -*- coding: utf-8 -*- # Author: Volkan Şahin +import datetime import grp +import hashlib import json import os import pwd import shutil import stat import subprocess -import hashlib -import datetime import uuid @@ -44,7 +44,8 @@ class Util: @staticmethod def delete_file(full_path): try: - os.remove(full_path) + if Util.is_exist(full_path): + os.remove(full_path) except: raise