`pickle`: yet another `ImportError: No module named my_module`

后端 未结 2 1941
清歌不尽
清歌不尽 2020-12-21 09:29

I have a class MyClass defined in my_module. MyClass has a method pickle_myself which pickles the instance of the class i

2条回答
  •  眼角桃花
    2020-12-21 09:38

    In case someone is having same problem, I had the same problem running Python 2.7 and the problem was the pickle file created on windows while I am running Linux, what I had to do is running dos2unix which has to be downloaded first using

    sudo yum install dos2unix
    

    And then you need to convert the pickle file example

    dos2unix data.p
    

提交回复
热议问题