So everytime I attempt to “process” a save file it spits:
> File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0Libtkinter__init__.py", line 1967, in __call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "d:sourceBBSaveEditorFixapp.py", line 291, in _process_data_user
self.data, self.user = process_user(self.file_location)
^^^^^^^^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable bool object
Here’s the code for line 291:
def _load_all_gems(self):
if self.gems is None:
messagebox.showwarning("File not loaded!", "You can not reset all modifications since no file is loaded")
return
self.combobox_all_gems['values'] = [list(gem.get_original_stats())[0] for gem in self.gems]
def _set_original_gem_stats(self, e=None):
if e is not None:
for gem in self.gems:
if list(gem.get_original_stats())[0] == e.widget.get():
self.selected_gem = gem
for i, (gem_menu, value) in enumerate(zip(self.all_gem_menu, list(self.selected_gem.get_original_stats()))):
if i > 2:
gem_menu.set(value)
else:
gem_menu.config(state="normal")
gem_menu.delete(0, END)
gem_menu.insert(INSERT, value)
gem_menu.config(state="disabled")
def _process_data_user(self):
if self.file_location is None:
messagebox.showwarning("User not loaded!", "No file selected")
self.data, self.user = process_user(self.file_location)
self._set_original_users_stats()
def _process_data_gems(self):
if self.file_location is None:
messagebox.showwarning("File not loaded!", "No file selected")
self.data, self.gems = process_gems(self.file_location)
self._load_all_gems()
def _open_file_selection(self):
self.file_location = filedialog.askopenfilename(initialdir="./")
self.file_loc_ent.config(state="normal")
self.file_loc_ent.delete(0, END)
self.file_loc_ent.insert(INSERT, self.file_location)
self.file_loc_ent.config(state="disabled")
Here’s the process_user code:
def proecess_user(filename: str):
data = None
with open(filename, "rb") as f:
data = f.read()
hexdata = binascii.hexlify(data)
if not data.startswith(b"41000000000000"):
return False
return data, extract_user_info(data)
def process_gems(filename: str):
data = None
with open(filename, "rb") as f:
data = f.read()
data = binascii.hexlify(data)
if not data.startswith(b"41000000000000"):
return False
return data, extract_gems(data)
New contributor
noob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
This expects the function to return a sequence of two values:
self.data, self.user = process_user(self.file_location)
But the function can possibly return a single value:
if not data.startswith(b"41000000000000"):
return False
… which causes the error.
3