代码打开时我得到了同样的错误(filname)。 在这里讨论之后, Python pickle error: UnicodeDecodeError
我将其更改为打开(filname,'rb')。我仍然得到错误。
/Users/sheetalpandrekar/Google Drive/Research/Health-care Analytics/Twitter/Opioid/TwitterUserType/PrepareData/Twitter_User_Types/Classifier/TwoPhaseTwitterClassifier2.py in loadClassifierFromFile(self, class1, class2)
32
33 def loadClassifierFromFile(self,class1,class2):
---> 34 self.clf1=pickle.load(open(class1, 'rb'))
35 self.clf2=pickle.load(open(class2, 'rb'))
36 pass
/Library/anaconda/lib/python3.5/codecs.py in decode(self, input, final)
319 # decode input (taking the buffer into account)
320 data = self.buffer + input
--> 321 (result, consumed) = self._buffer_decode(data, self.errors, final)
322 # keep undecoded input until the next call
323 self.buffer = data[consumed:]
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte