Ask coding questions

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

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 (2242) [earned 5 cycles]
View Answer
Commentshotnewtop
1
mat1 (2242)

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!