@@ -412,7 +412,10 @@ def __init__(self, func):
412412 self ._func = func
413413
414414 def run (self ):
415- self ._builder = self ._func ()
415+ try :
416+ self ._builder = self ._func ()
417+ except Exception :
418+ self ._builder = None
416419
417420 @property
418421 def builder (self ):
@@ -478,7 +481,7 @@ def __init__(self, dict_path):
478481 self .html_cache = defaultdict (str )
479482 self .query_interval = 0.01
480483 self .styles = []
481- if self .support :
484+ if MdxService . check ( self .dict_path ) :
482485 self .builder = self ._get_builer (dict_path , service_wrap (MdxBuilder , dict_path ))
483486
484487 @staticmethod
@@ -487,7 +490,7 @@ def check(dict_path):
487490
488491 @property
489492 def support (self ):
490- return MdxService .check (self .dict_path )
493+ return self . builder and MdxService .check (self .dict_path )
491494
492495 @property
493496 def title (self ):
@@ -647,21 +650,21 @@ class StardictService(LocalService):
647650 def __init__ (self , dict_path ):
648651 super (StardictService , self ).__init__ (dict_path )
649652 self .query_interval = 0.05
650- if self .support :
653+ if StardictService . check ( self .dict_path ) :
651654 self .builder = self ._get_builer (
652655 dict_path ,
653656 service_wrap (StardictBuilder , dict_path , in_memory = False )
654657 )
655- #self.builder = StardictBuilder( self.dict_path, in_memory=False)
656- self .builder .get_header ()
658+ if self .builder :
659+ self .builder .get_header ()
657660
658661 @staticmethod
659662 def check (dict_path ):
660663 return os .path .isfile (dict_path ) and dict_path .lower ().endswith ('.ifo' )
661664
662665 @property
663666 def support (self ):
664- return StardictService .check (self .dict_path )
667+ return self . builder and StardictService .check (self .dict_path )
665668
666669 @property
667670 def title (self ):
0 commit comments