ValueError: insecure string pickle

后端 未结 10 1516
轻奢々
轻奢々 2020-12-03 04:00

When I am trying to load something I dumped using cPickle, I get the error message:

ValueError: insecure string pickle

Both the dumping and

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 05:01

    This is what happened to me, might be a small section of population, but I want to put this out here nevertheless, for them:

    Interpreter (Python3) would have given you an error saying it required the input file stream to be in bytes, and not as a string, and you may have changed the open mode argument from 'r' to 'rb', and now it is telling you the string is corrupt, and thats why you have come here.

    The simplest option for such cases is to install Python2 (You can install 2.7) and then run your program with Python 2.7 environment, so it unpickles your file without issue. Basically I wasted a lot of time scanning my string seeing if it was indeed corrupt when all I had to do was change the mode of opening the file from rb to r, and then use Python2 to unpickle the file. So I'm just putting this information out there.

提交回复
热议问题