[Solved] PyInstaller Error: ValueError: too many values to unpack

Execution: pyinstaller .\checkattendance.spec

report errors:

for name, pth in format_binaries_and_datas(datas, workingdir=spec_dir):
File "d:\python\winpython-64bit-\python-2.7.10.amd64\lib\site-packages\PyInstaller\building\utils.py", line 440, in format_binaries_and_datas
for src_root_path_or_glob, trg_root_dir in binaries_or_datas:
ValueError: too many values to unpack

When reading an error, there should be a problem with the format of the data in the data or binaries. Think of adding content to the data field of the spec file, such as data = [“config.Ini”, ‘.’]

According to the information, the list of data is a list of tuples, and the tuple is a tuple of two elements. The first element is the position when reading the file in Python code, and the second element represents the real directory of the data file to be read.

So the format should be data = [(“config.Ini”, ‘.’)]

After modification, execute pyinstaller .\checkattendance.spec

It can be packed smoothly. I hope it can help you with the same problem~

Read More: