LoginSignup
2

More than 5 years have passed since last update.

pythonのpickleロード時にAttributeError: Can't get attribute 'クラス名' on <module '__main__' (built-in)>と出る場合

Last updated at Posted at 2016-08-30

pythonのpickleをロードするときに

AttributeError: Can't get attribute 'クラス名' on <module '__main__' (built-in)>

と出る場合、このロード対象クラスが記述されているファイルの

if __name__ == "__main__":
     hogehoge

と記述されている部分を削除し、もう一度pickleを書き出し、読み込みを行うと動くかも。

上記部分を削除するだけだと多分動かない。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2