I'm writing this procedure
def get_special_paths(dir):
detected_paths = []
paths = os.listdir(dir)
for path in paths:
if path == r'__\w+__':
detected_paths.append(path)
for element in detected_paths:
index = detected_path.index(element)
detected_paths[index] = os.path.abspath(element)
return detected_paths
and it raises a a type error as below:
Traceback (most recent call last):
File"copyspecial.py", line 65, in <module>
get_special_paths(dir)
File"copysepcial.py", line 23, in get_special_paths
paths = os.listdir(pathname)
TypeError: coercing to Unicode: need string or buffer, builtin_function_or_method found
What's the meaning of that error and how do I fix it? Thanks in advance :)