displaycal-py3
displaycal-py3 copied to clipboard
"Can't mix strings and bytes in path components" when installing a profile on a Mac
I have built and ran Displaycal on a Mac (M1 Pro, Ventura). When I attempt to install the profile for current user only, I get an error "Can't mix strings and bytes in path components", at worker.py
line 13968:
profile_tmp_path = os.path.join(
tmp_dir, safe_asciize(profile_name)
)
the function safe_asciize
returns a byte object, which then cannot be os.path.join
ed with the tmp_dir
which is a normal string.
profile_name
is U3277WB #2 2022-10-28 13-16 120cdm² D6500 2.2 F-S 1xCurve+MTX.icc
the output of safe_asciize(profile_name)
is b'U3277WB #2 2022-10-28 13-16 120cdm2 D6500 2.2 F-S 1xCurve+MTX.icc'
I edited safe_asciize
function:
elif isinstance(obj, str):
return obj.encode("ASCII", "safe_asciize")
into
elif isinstance(obj, str):
return obj
Which made the installation of the profile work, but I assume it is not a proper solution.
I barely know python so I don't know how it is supposed to work. Should the tmp_dir
be a b''
as well if the safe_asciize
returns a byte object instead of a string?
DisplayCal 3.9.11, macOS sonoma 14.3 - issue still present