fix
This commit is contained in:
parent
ea069700aa
commit
8e7c1ed7bf
@ -1,5 +1,5 @@
|
||||
import base64,hashlib,os,shutil
|
||||
import math
|
||||
import math,time
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
from tinydb import TinyDB, Query
|
||||
@ -206,7 +206,8 @@ class fileUtils:
|
||||
|
||||
@classmethod
|
||||
def ver_file(cls,file_path,type):
|
||||
if type == "image":
|
||||
time.sleep(0.1)
|
||||
if type == "image" and int(os.path.getsize(file_path)) > 100:
|
||||
#验证是否是图像
|
||||
try:
|
||||
img = Image.open(file_path)
|
||||
@ -217,6 +218,9 @@ class fileUtils:
|
||||
os.remove(file_path)
|
||||
print(f"{file_path}已损坏 type:{type},删除重试中")
|
||||
return False
|
||||
else:
|
||||
print(f"文件小于100b,{file_path}")
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def remove(cls,path):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user