I don't know where's the problem. Can you help me?
main.py
import os
from functions import *
if __name__ == "__main__":
path = os.getenv('path')
print(readFiles(path))
functions.py
import os
def readFiles(patha):
res = []
# Iterate directory
currentpath = os.listdir(patha)
for path in currentpath:
# check if current path is a file
if os.path.isfile(os.path.join(patha, path)):
res.append(path)
else:
pathf = patha + path + '/'
res.append(readFiles(pathf))
return res
I wanted to make a file list in python and this error appeared. No idea what went wrong.