import sys,os def cur_file_dir(): path = sys.path[0] if os.path.isdir(path): return path elif os.path.isfile(path): return os.path.dirname(path) # print cur_file_dir() def GetFileList(path): FileList = [] FileNames = os.listdir(path) return FileNames print (GetFileList(cur_file_dir()))