Unicode object is not callable
Upon using beet duplicates...
C:\Users\100557855>beet duplicates
Traceback (most recent call last):
File "C:\Python27\Scripts\beet-script.py", line 9, in <module>
load_entry_point('beets==1.3.11', 'console_scripts', 'beet')()
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 953, in main
_raw_main(args)
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 943, in _raw_ma
in
subcommand.func(lib, suboptions, subargs)
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 232, in _dup
format=fmt.format(obj_count))
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 48, in _proc
ess_item
print_(format(item, format))
TypeError: 'unicode' object is not callable
@brunal, can you please take a look at this if you get back from holiday before I get to it? Seems related to #1269.
This is caused by _process_item in duplicates.py having an argument named format, which shadows the function format responsible for actually formatting. Resulting in:
format = '' # passed from function argument
# ...function logic...
print_(format(item, format)) # format is unicode, crash
So it's easily fixed by renaming the argument to fmt (as its been done in other places). I guess this one was just overlooked with the big refactoring.
Excellent; looks right to me. @willgrnr, can you confirm that this is fixed now?
By the way, the convert plugin uses format as an argument / variable all over the place too (used to indicate fileformat of items). I'm not sure if this is problematic already, but it's probably asking for trouble with the shadowing, so guess it wouldnt hurt to refactor it to something like fileformat.
@sampsyo @tomjaspers everything looks good from my end, thanks a bunch!
Yeah, that could get a little weird. I'm not opposed to shadowing built-ins like this in general, it has so far burned us once. Maybe like path_format would be a good general recommendation in the future.
Small 1-commit PR that deletes remaining format usages as a variable.