Why do I get “Pickle - EOFError: Ran out of input” reading an empty file?

前端 未结 7 2400
小鲜肉
小鲜肉 2020-11-28 05:55

I am getting an interesting error while trying to use Unpickler.load(), here is the source code:

open(target, \'a\').close()
scores = {};
with o         


        
相关标签:
7条回答
  • 2020-11-28 06:44
    if path.exists(Score_file):
          try : 
             with open(Score_file , "rb") as prev_Scr:
    
                return Unpickler(prev_Scr).load()
    
        except EOFError : 
    
            return dict() 
    
    0 讨论(0)
提交回复
热议问题