cannot unpack non-iterable bool object

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

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật