It seems like you passed the dir
builtin function to the get_special_paths
>>> dir
<built-in function dir>
>>> os.listdir(dir)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: coercing to Unicode: need string or buffer, builtin_function_or_method found
Pass the path as string.
get_special_paths('/path/to/dir')
BTW, don't use dir
as a variable name. It will shadow the above dir
function.