File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -54,16 +54,23 @@ def openfile(self):
54
54
55
55
56
56
def double_click_search_table (self , info ):
57
- file_path = self .resultTable .item (info .row (), 0 ).text ()
58
- os .startfile (os .path .normpath (file_path ))
57
+ file_path = os .path .normpath (self .resultTable .item (info .row (), 0 ).text ())
58
+ if os .path .exists (file_path ):
59
+ os .startfile (file_path )
60
+ else :
61
+ QtWidgets .QMessageBox .warning (self , '警告' , '图片文件不存在:' + file_path )
59
62
60
63
61
64
def double_click_duplicate_table (self , info ):
62
65
col = info .column ()
63
66
if col > 1 :
64
67
return
65
68
row = info .row ()
66
- os .startfile (self .resultTableDuplicate .item (row , col ).text ())
69
+ file_path = self .resultTableDuplicate .item (row , col ).text ()
70
+ if os .path .exists (file_path ):
71
+ os .startfile (file_path )
72
+ else :
73
+ QtWidgets .QMessageBox .warning (self , '警告' , '图片文件不存在:' + file_path )
67
74
68
75
69
76
def start_search (self ):
Original file line number Diff line number Diff line change @@ -99,8 +99,11 @@ def remove_nonexists(self):
99
99
exists_index = json .loads (open (self .exists_index_path , 'rb' ).read ())
100
100
for idx in tqdm (range (len (exists_index )), ascii = True , desc = '删除不存在文件' ):
101
101
if not os .path .exists (exists_index [idx ]):
102
- exists_index [idx ] = NOTEXISTS
103
- self .ir_engine .hnsw_index .mark_deleted (idx )
102
+ exists_index [idx ] = NOTEXISTS
103
+ try :
104
+ self .ir_engine .hnsw_index .mark_deleted (idx )
105
+ except :
106
+ pass
104
107
with open (self .exists_index_path , 'wb' ) as wp :
105
108
wp .write (json .dumps (exists_index ,ensure_ascii = False ).encode ('UTF-8' ))
106
109
You can’t perform that action at this time.
0 commit comments