Ask coding questions

← Back to all posts
Python - Weird Error Encountered
launcherman08 (22)

Hey, so I'm building a game. I asked a question before. (Click to view the question) I did all the load stuff different, but then I encounter this (really) weird error:

Help please!

Answered by mat1 (3432) [earned 5 cycles]
View Answer
mat1 (3432)

Here is the code that's broken:

load = open("save.txt", "r")
company_data = pickle.load(load)

The reason why it's not working is because load is reading a string and not bytes. Replace the r (read) with rb (read bytes) to fix that.

Also, in lines 14-19 you are trying to get information from company_data with invalid variables. To fix this, replace them with strings (add quotes around stores, offices, etc)
Please mark my comment as the answer if it helped you. Thanks!