When Attribute Error: Can't get attribute'class name' on <module'__main__' (built-in)> appears when loading python pickle

When loading python pickle

AttributeError: Can't get attribute 'name of the class' on <module '__main__' (built-in)>

If you see, in the file that describes this load target class

if __name__ == "__main__":
     hogehoge

It may work if you delete the part described as, write the pickle again, and read it.

If you just delete the above part, it probably won't work.

Recommended Posts

When Attribute Error: Can't get attribute'class name' on <module'__main__' (built-in)> appears when loading python pickle
I get a can't set attribute when using @property in python
When Python "Syntax Error: Non-ASCII character ~" appears
When codec can't decode byte appears in python
I get an error when I try to raise Python to 3 series using pyenv on Catalina
When I try to update the data on DynamoDB with Python (boto3), I get "ExpressionAttributeNames contains invalid key: Syntax error; key: <key name>"
[Python] Get element by specifying name attribute in BeautifulSoup
When you get an error in python scraping (requests)
What to do when you get an error saying "Name resolution temporarily failed" on linux
When Runtime Error: maximum recursion depth exceeded while pickling an object appears in python pickle