The below command gives an empty [] when I try to set the path in the dirPath variable. However it works only when I run this in the python interpreter by changing to that directory specified by dirPath. What is the problem here? I want this line to give the correct output from any directory.
print [os.path.abspath(name) for name in os.listdir(dirPath) if os.path.isdir(name)]