problem loading old models and saving new models

472 views
Skip to first unread message

Krista Bond

unread,
May 3, 2018, 1:04:50 AM5/3/18
to hddm-users
Hi, 

I'm having a problem loading old models. I receive this error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

Also, if I try to save new models, I get this error: 

TypeError: write() argument must be str, not bytes

I saw that other users have had this problem, but the resolutions were workarounds (installing an older version of python, for example) and the responses were from a year or two ago. What's the best way to solve these two problems?

Thanks for your help!

Krista

Krista Bond

unread,
May 3, 2018, 1:06:01 AM5/3/18
to hddm-users
also, I'm using Python 3.6.4 and HDDM version 0.6.0.

lawlor.v...@gmail.com

unread,
May 3, 2018, 2:36:22 PM5/3/18
to hddm-users
I was able to fix this by editing two files in kabuki. In utils.py, try changing 

model = pickle.load(open(fname, 'r')) ---> model = pickle.load(open(fname,'rb))

In hierarchical.py, change
pickle.dump(self, open(fname, 'w')) ---> pickle.dump(self, open(fname,'wb'))

Hope that works! 


On Thursday, May 3, 2018 at 1:04:50 AM UTC-4, Krista Bond wrote:

Krista Bond

unread,
May 4, 2018, 12:15:33 AM5/4/18
to hddm-users
That worked! Thanks!
Reply all
Reply to author
Forward
0 new messages