Probably, it's your indentation.
Python is a silly language: indentation is very important because it not only indicates to the reader what is going on (as in sensible languages) is also delimits the start and end of blocks of code. Code which is indented to the same level forms a "block of code", and it ends when a "Less indented" line is encountered.
So in this code:
def convert_pc2ply(anno_path, save_path):
os.listdir(anno_path)
data_list = []
for f in glob.glob(join(anno_path, '*.txt')):
Only one line is inside the function
convert_pc2ply
, all the rest is part of the main code.
And since the function is never called in that fragment, the
os.listdir
is not called either and ends up empty when you try to use it.
Indent the
data_list
line, and it might start to work.